ksngroups wrote:
class Base
{
public:
/** class contain1 has only virtual functions. Can they be pure too??
Any virtual function can be pure.
*/
class Contain1
{
virtual void Func1();
virtual void Func2();
}
};
class Derived : Base
{
public:
/** class contain1 v-Functions are overriddable here?? **/
void B1::Contain1().Func1();
void B1::Contain1().Func2();
};
You probably come from Java-land.
In C++, even though the Base class contains the Contain1 class, a Base
object contains no Contain1 object unless you put it there. Next, each
virtual function anchors to its objects with a secret pointer, or similar
system, inside its object. In your system, only Contain1 contains the secret
pointer to a vtable.
So when you derive, the Derived class objects also get no automatic Contain1
object. So we cannot upgrade C++ to make your curious syntax work, because
Derived has no virtual methods in its vtable, or similar system, to
override.
This would work:
class Derived: public Base::Contain1
{
virtual void Func1();
void Func2();
};
Both override; the "virtual" is optional.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!