-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jakob Bieling wrote:
cm****@hotmail.com wrote: Hi
How can we force all the class A's subclass inherit all its
functions? Or how can we force class B to inherit function abc()?
There is no need to. All classes that you derive from A will
automatically inherit all member functions of A.
class A{
public:
virtual void abc();
};
class B:public A{
};
int main(){
return 0;
}
hth
to force the implementor of the deriving class to do his own
implementation, add a "= 0" to the declaration of the method.
I.e.:
class A {
public:
virtual void abc() = 0;
};
HTH,
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (SunOS)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFEJ/nJ6U+hp8PKQZIRAsD6AKCYwzaPtpsRZYyACUxXoLFMLMFWyQCg tsUd
t4Wop7dOk0nGTdvWMwMXYL0=
=R/en
-----END PGP SIGNATURE-----