Communication between functions of class

Hi,

I have a class as follows:
1
2
3
4
5
6
7
8
class testa
{
public:
   testa_b();
   ~testa_b();

   testa_c();
}

Then I have defined some variables in testa_b:
1
2
3
4
testa::testa_b()
{
   double aa = 1.0;
}

What is the easiest way to make testa_c() can use the aa defined in testa_b() (without declaring them in the class)? Could anyone please let me know? Thanks!
Last edited on
aa defined in testa_b is function local. That means it will be detroyed when function ends. You can return this value as result of function and use it like
1
2
3
4
testa_c()
{
    double x = testa_b()
}

Actualyy your functions have an error: your constructor and destructor should be named testa()/~testa()
And other functions should have a return type.
If you don't want to make it a member of the class, then pass it as an argument.
Thanks. In case I have a lot of variables to define, I think it's better to define them in the class. So the other functions can access. Right?
I don't want to have 50 arguments in a function...
Sorry for the errors. I wrote them too fast... :(
Topic archived. No new replies allowed.