A * is exactly what it looks like. A pointer to type A. However if A is polymorphic through the use of virtual functions then you can use an A * to point to an instance of B or C and when you call the virtual functions via the A * base pointer it will actually call the implementations of the functions in B or C.
If your functions in A are not polymorphic (declared virtual) then when you call them on an instance of B or C through a base class pointer A * it will call the function defined in A.
This may make more sence with an example
-
class A
-
{
-
public:
-
A();
-
virtual ~A(); /* Very important on a polymorphic/abstract
-
class to declare destructor virtual */
-
-
void nonVirtualFun();
-
virtual void virtualFun();
-
}
-
-
class B : A
-
{
-
public:
-
B();
-
virtual ~B(); /* Very important on a polymorphic/abstract
-
class to declare destructor virtual */
-
-
void nonVirtualFun();
-
virtual void virtualFun();
-
}
-
-
B *myB = new B; // Create a B
-
A *basePtr = myB; // Take a base class pointer to it
-
-
myB->nonVirtualFun(); // Calls B::nonVirtualFun
-
A->nonVirtualFun(); // Calls A::nonVirtualFun
-
-
myB->virtualFun(); // Calls B::virtualFun
-
A->virtualFun(); // Calls B::virtualFun
-
-
delete myB;
-