Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!tektronix!sequent!mntgfx!archiel From: archiel@mntgfx.mentor.com (Archie Lachner) Newsgroups: comp.lang.c++ Subject: Re: objective C Message-ID: <1989May4.151324.6717@mntgfx.mentor.com> Date: 4 May 89 22:13:21 GMT References: <1546@sw1e.UUCP> Organization: Mentor Graphics Corporation, Beaverton Oregon Lines: 29 From article <1546@sw1e.UUCP>, by uucibg@sw1e.UUCP (3929]): > This gives me an opportunity to clear up a question I've had for quite a > while. Is it possible to do the following: > > Joe writes a class called Window and compiles it for a particular workstation/ > OS release. The implementation of Window is of arbitrary complexity (e.g. it > may involve virtual functions or any other construct allowed by C++). He then > sends the compiled file plus a '.h' to Fred. > > Fred uses the .h to write a class derived from Window, compiles it, and links > it together with the object file for Window (along with other stuff) to produce > a working program. > > Will this work? If so, good deal. ... Yes, this absolutely works. Stroustrup's book mentions this explicitly, and it definitely works in practice in every version of C++ ever released. Functions declared virtual in the base class Window will be replaced by the corresponding functions in the derived class (assuming they exist). This will be true even for function calls through pointers to Window objects in the precompiled code if these pointers point to objects of the derived class (they are passed to the precompiled code, for example). Those making statements to the contrary are perhaps not well informed about C++. -- Archie Lachner Mentor Graphics Corporation Beaverton, Oregon ...!{decwrl,sequent,tessi}!mntgfx!archiel