Is it possible to modify the value of a variable declared in a class by calling an object created outside that class?
here is an example:
here is an example:
Code:
class CMyClass {
public:
CMyClass() { m_nNum = 0; }
void OnPaint();
void Draw();
BOOL m_nNum;
...
..
};
.....
#include "myclass.h"
.....
void CMyClass::OnPaint() {
......
if(m_nNum == 1) {
Draw();
}
}
....
...
#include "myclass.h"
// creating an object outside the class
CMyClass myObject;
// can i use "myObject" to modify the value of "m_nNum"?