pittenger-laurence@cs.yale.edu (Laurence Arthur Pittenger) (04/28/91)
I have an object, call it myObject, with a descendant, call it myChild. Both support a method, call it MyMethod. in myChild, I want to call on MyMethod in myObject, so I write inherited::MyMethod(...) and it works fine. In myObject, I want MyMethod to call on itself sometimes. Since the MyMethod is sometimes called from myObject and sometimes from myChild, I can't merely call "MyMethod" or "this->MyMethod", because in the case of the myChild it will go back to myChild::MyMethod rather than myObject::MyMethod, which is what I want. So, following the (very sparse) documentation in the Think C documentation, I call "myObject::MyMethod(...)". The result? The compiler returns "invalid method call" (or something approximating that msg). HUNH?!! thanks in advance, LP -- Laurence A. Pittenger CSNET : pittenger-laurence@cs.yale.edu BITNET : pitlaua@yalevm , pittenger-laurence@yalecs
Jim.Russell@p395.f421.n109.z1.FidoNet.Org (Jim Russell) (04/29/91)
LA> So, following the (very sparse) documentation in the Think C LA>documentation, I call "myObject::MyMethod(...)". The result? The LA>compiler returns "invalid method call" (or something approximating LA>that msg). HUNH?!! I was having problems like that, and convinced myself for a while that a call, for example, of the form inherited::foo could only be made from a method that was itself called foo. Thanks to Philip Keller I was shown that I was wrong, and have since found that most of my "invalid method call" errors were cockpit errors - I failed to #include the CParent.h file, I had a missing ";" or */, etc. It's one of those things that I have not proved to myself, but they have gone away as I have kept cleaning things up. * Origin: Gaithersburg, MD (1:109/421.395)