Thomas Hallgren wrote:
Speaking in generic OO terms, using inheritance, you cannot remove
attributes that are present in the generalisation. If B inherits A, an
instance of B is per definition also an instance of A. Thus, you must alwasy
be able to cast a B into an A. In short, If you don't want the OID, you
cannot inherit a something that has an OID.
This is not completely true:
struct B { void foo(); };
class D : public B { private: void foo();
public: void bar(); };
as you can see a D "is a" B but the publich foo() doesn't appartaint to D, at least an user of D could not use foo()
C++ is not exactly the model for OO semantics. It's a fairly wierd addition to C resulting in a hybrid language where quite a few constructs violates sane OO. Try to use a similar construct in a more elaborate OO-language (like Java, C#, etc.) and you will get an error like:
"foo() in D cannot override foo() in B; attempting to assign weaker access privileges; was public"
which makes a lot more sense.
Kind regards,
Thomas Hallgren
PS. This discussion doesn't really belong here. I'd be happy to continue it off the list though.
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings