Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!ccncsu!ncr-fc!frodo From: frodo@ncr-fc.FtCollins.NCR.COM (David Fletcher) Newsgroups: comp.lang.c++ Subject: virtual vs. non-virtual functions. Message-ID: <201@ncr-fc.FtCollins.NCR.COM> Date: 9 Mar 89 16:28:54 GMT Reply-To: frodo@ncr-fc.UUCP (David Fletcher) Followup-To: comp.lang.c++ Distribution: na Organization: NCR Fort Collins, Colorado Lines: 28 Hello. First of all, this is under AT&T 1.2.1 cfront. I have a base class, B, and a publicly derived class, D. The base class defines a non-virtual public member function, Value(), that returns the value of some protected entry. D does not define this member function (&, again, Value() is not virtual). Out of curiosity I tried: . . B SomeDooDad; D OtherDooDad; cout << "B's value is " << SomeDooDad.Value() "\n"; cout << "D's value is " << OtherDooDad.Value() "\n"; . . This works but I didn't expect it to & don't understand why. I thought that only virtual functions (defined in a based class) would be defined for the derived class. If that's not the case then why even have the virtual keyword? Is this a bug? Am I wrong? Thanks for the help. -- David Fletcher, NCR Microelectronics 2001 Danfield Court, Ft. Collins, CO 80525 | "... Let everything else go ..." (303) 223-5100 x 241 | -- Phil Keaggy