P
Peter Liu
This simple code
typedef strt B{
int b;
}BS;
typedef struct A:B
{
int a;
int foo(){return a+b;}
}AS;
int main()
{
AS*pab=new AS();
pab->b=4;
pab->a=5;
pab->a=pab->foo();
***********//Output result is incorrect only 4 //***********
delete pab;
}
Why isn't the output 9 as it is supposed to be ?
Thanks
typedef strt B{
int b;
}BS;
typedef struct A:B
{
int a;
int foo(){return a+b;}
}AS;
int main()
{
AS*pab=new AS();
pab->b=4;
pab->a=5;
pab->a=pab->foo();
***********//Output result is incorrect only 4 //***********
delete pab;
}
Why isn't the output 9 as it is supposed to be ?
Thanks