Jacek Dziedzic $B$N%a%C%;!<%8(B:
> Peter Liu wrote:
> > 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 ?
>
> It is 9 on my system, after changing "strt" to
> "struct" and adding an actual output statement.
> That goes to show you haven't given us the actual
> code that fails.
>
> Also note that what you are doing is assignment,
> not initialization.
>
> - J.
Sorry everyone, it works correctly, my mistake hehehhe.