Xref: utzoo comp.object:401 comp.lang.c++:5476 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!agate!saturn!sidney From: sidney@saturn.ucsc.edu (Sidney Markowitz ) Newsgroups: comp.object,comp.lang.c++ Subject: Re: Understanding the Object-Oriented Life-Cycle Message-ID: <9707@saturn.ucsc.edu> Date: 10 Nov 89 10:46:29 GMT References: <5026@internal.Apple.COM> <315@shrike.AUSTIN.LOCKHEED.COM> Reply-To: sidney@saturn.ucsc.edu (Sidney Markowitz ) Organization: University of California, Santa Cruz Lines: 35 aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) writes (in comp.object): > >On a naive note, does C++ or any other C-based OO extensions support >different types of method combination? I, too, come from a Lisp background. Would someone with more C++ experience please comment on the accuracy of the following? (Note: If you don't know better, please don't assume the following is true - I'm really asking a question): My reading of the spec is that C++ has no method combination. If a derived class has a member function of the same name as a member function of a base class, only the derived class's member function is used when it is called. With multiple inheritance, if there's more than one base class with a member function of a certain name, then either the derived class has to also have a member function defined with that name, or any call to that function for an instance of that class has to be explicitly qualified by the name of one of the base classes. Using the non-C++ terminology I'm more familiar with, I would say it this way: If you have child class CH1 inheriting from parent classes P1 and P2, and V1 is an instance of CH1, then If P1 has a method foo, you can call V1.foo() and it will refer to the method defined on P1, i.e., P1::foo. If P2 also has a method foo, then V1.foo() will generate a compile-time error since it is ambiguous. However if CH1 has a method foo defined then V1.foo() will always be legal and will refer only to CH1::foo. In that case, to refer to the foo methods of the parents, you would have to say things like P1::foo(V1) or P2::foo(V1). -- sidney markowitz