I have two files sampleclass.cpp and sampledataclass.cpp along with sampleclass.h and sampledataclass.h
In sampleclass.cpp in the constructor I give a value to a variable
sampleclass.cpp
sampleclass:sampleclass(){
x = "some string value";
}
In sampleclass.h I create x and an instance of the data class
sampleclass.h
CString x;
sampledataclass myDC;
Now in the constructor of the data class I want to be able to set the value of another string to the value of x
sampledataclass.cpp
sampledataclass:sampledataclass(){
CString y = mysampleclass->x;
}
The h file has this
sampleclass.h
sampleclass *mysampleclass;
How do I do this without getting a runtime error