|
|
#include<iostream>
#include<conio.h>
#include<atlbase.h>
class A{
public:
int a;
int first(int *h,int n){
ATLTRACE2("First%s\n","First");
go(h,n);
return 0;
};
int virtual go(int *h,int n)
{
if (n==0) return 0;
ATLTRACE2("ClassA:%i\n",*h);
*h=*h-5;
go(h,n-1);
return 0;
};
};
class B:public A{
public:
B(int g);
~B(void);
int b;
int go(int *h,int n)
{
ATLTRACE2("ClassB: %i\n",*h);
return A::go(h,n);
};
};
void main()
{
int y=0;
B *b=NULL;
B *bb=new B(y);
B CB(y);
b=&CB;
A CA;
A *a=NULL;
a=&CA;
int i=100;
//a->first(&i,5);
bb->first(&i,5);
ATLTRACE2("%d\n",i);
} |
|