Prev: needing std::iostream as an array of bytes
Next: omission of "virtual" in overridden method declarations in derived classes
From: Gregory Bok on 22 Feb 2010 05:57 Say you have a class with a virtual method, and then in a derived class, the virtual method is declared without the "virtual" keyword. class A { public: virtual void method(); }; class B { public: void method(); }; Is this effectively an emulation of the "final" construct, e.g. this becomes a leaf class in the absence of other overridable methods? Does this impact the ability to treat instances of B polymorphically? Or is the virtuality inherited implicitly from the root of the inheritance tree even if it is omitted in intermediate classes? Is the behavior here implementation dependent? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |