D
DPfan
Is the following so-called "delegation"? If not how to make some changes so
that the F class delegates its operation to an E instance.
On the other hand the following code runs without any problem. Is there any
potential problems with it?
class E
{
public:
void Draw_E(int a, int b) { cout << "Draw in E " << a*b<< endl; }
};
class F
{
E *e;
public:
void Draw_F() { e->Draw_E( 123, 456 ); cout << "Draw in F" << endl; }
};
int main(void){
F f;
f.Draw_F();
return 0;
}
that the F class delegates its operation to an E instance.
On the other hand the following code runs without any problem. Is there any
potential problems with it?
class E
{
public:
void Draw_E(int a, int b) { cout << "Draw in E " << a*b<< endl; }
};
class F
{
E *e;
public:
void Draw_F() { e->Draw_E( 123, 456 ); cout << "Draw in F" << endl; }
};
int main(void){
F f;
f.Draw_F();
return 0;
}