|
-
December 22nd, 2005, 10:17 PM
#1
Weird Problem: delegation or inheritance
As we know, delegation and inheritance can realize the same functionality.
For example,
class A : public B
{
virtual double fun();
}
and
calss A
{
double fun()
{
b_.fun();
}
private:
B b_;
}
In general, I can choose either one. However, in my program I can only use the delegation method. If the inheritance is used, it will cause weird behavior of other part of the code.
Any one has any clue what is going?
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|