Original Post
I have the following code: From the compiler's perspective, why is TestFuncPointer a valid function, while TestFuncStack is not????
struct A {
bool changed;
};
struct B {
A *pObj;
A sObj;
B() : pObj(new A) { }
void TestFuncPointer() const {
pObj->changed = true;
}
void TestFuncStack() const {
sObj.changed = true;
}
};
B test;
test.TestFuncPointer();
test.TextFuncStack();