-4

XX.HEADER

class ABC
{
public:
ABC(); // constructor
int XYZ(int );
int AA;
    int m
}

XX.CPP

Mat ABC::XYZ(int c)
{

AA = lambda;
return m;

}

MAIN.CPP

int main()
{
ABC myObject;
int labda = myObject.AA;

}

I want value of AA to be used in main function.

Suppose there is a header file with class definition and member function definition along with some public data members say

AA.

Now in the cpp file for the header file with contain complete description of the header file along with function definition within the class. The data member

AA

contains some value within the member function. Now I want to use this data member AA

in the main function. How can I do that. Right now I have just intialiazed in public: int AA and in function it is giving some integer value which is getting stored. Now I want to use this AA in main function.

hawkeye
  • 349
  • 4
  • 21
  • Do you mean `int mainAA = myObject.AA;`? – DeVadder Apr 07 '14 at 10:41
  • yeah but its not working. I am successfully getting the result of the function " int mainfuntionresult = myObject.functionName()" but I also want to use AA which is one of the byproduct in the function "functionName()". – hawkeye Apr 07 '14 at 10:46
  • Your code is full of compile time errors. Please post real code. – Sebastian Mach Apr 07 '14 at 11:21

1 Answers1

0

Post a smallest example of your problem using actual C++. But from that... i would not even call it pseudo-code, your problem might be that you need to call

myObject.XYZ(someInteger);

before you inspect myObject.AA.

Also, when you post some actual code, also state what exactly goes wrong. Is there a runtime error, is the value just unexpected, does your computer explode?

DeVadder
  • 1,404
  • 10
  • 18