Your example is too simplistic. It's also flawed.
Pointers by themselves don't do anything. They have to actually point to something. Attempting to use a pointer without pointing to anything will do "bad things" (if you're lucky, it will crash the program).
For instance, your FunctionONE makes no sense:
1 2 3 4 5
|
void ClassB::FunctionONE()
{
ClassA *pClassA; // a pointer, but what does it point to?
ABC = pClassA->GetABC(); // whose ABC are you trying to get?
}
|
The 2nd question there is key. Whose ABC are you trying to get? Which bring up the bigger conceptual issue I think you're having: the difference between classes and objects.
A class is sort of like an outline for a "thing", whereas an object actually IS a "thing". For example,
string
is a class, and you can create individual strings by creating objects:
1 2 3
|
string foo; // string is the class, but foo is the object. foo actually is a string
int len = foo.length(); // whose length are we getting? foo's length!
|
Moving from that, when you make a pointer, you don't actually have an object. It's just a means by which to access another object:
1 2 3 4 5 6 7 8
|
string* ptr;
len = ptr->length(); // whose length are we getting? It can't be ptr's because ptr isn't a string - it's a pointer
// in order for this to mean anything, ptr has to actually point to a string:
ptr = &foo // now, ptr points to foo
len = ptr->length(); // now whose length are we getting? foo's length!
|
So your original question is somewhat flawed. You can't just "gain access" to ClassA's variables just by making a pointer. You have to specify which ClassA object you want to access. Which object's variables do you want to access?