Hello,
I am a newbee in C++. I am trying to have a connection setup and trying to access private varaibles of a class. Please look at my piece of code below. Any comments would be greatly appreciated.
Basically, I want to access two private varaibles from MyClass into AnotherClass(myNewClass = new MyClass(?, ?)).
Thanks.
Amy
//start of header
MyClass.h
class MyClass{
public:
//constructor
MyClass(xyz* const Var1_X, mno* Var2_M);
private:
xyz* const PrivateVar1;
mno* const PrivateVar2;
}
//end of header
//start of source
MyClass.cpp
MyClass(xyz* const Var1_X, mno* const Var2_M):PrivateVar1(Var1_X),PrivateVar2(Var2_M)
{
}
//end of source
//start of another source
AnotherClass.cpp
Class AnotherClass{
private:
MyClass* myNewClass;
public:
myNewClass = new MyClass(how do i get those two private varaibles here?)
//end of another source