luoys
asked on
Inheritance
Class A
{
int x;
}
Class B
{
int y;
}
Class C : public A, B
{
int z;
}
A *aa;
B *bb;
C cc;
aa = &c;
bb = &c;
Please can you tell me - do aa and bb point to the same address? If yes or no....why?
{
int x;
}
Class B
{
int y;
}
Class C : public A, B
{
int z;
}
A *aa;
B *bb;
C cc;
aa = &c;
bb = &c;
Please can you tell me - do aa and bb point to the same address? If yes or no....why?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah, that is true, I just put C.x and C.y .. because that is all that is there.. lol
First:
class is ALWAYS lowercase.
Second:
Each class ends with a ;
Third:
You can not set a variable (aa) equal to a class (c)
With all that said, they should not point to the same address. aa should point to C.x
bb should point to C.y Because class A only has one member as to Class B, and they
are different members than eachother, so the address should be different.