Path: utzoo!attcan!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: PolyMorphism Message-ID: <54033@microsoft.UUCP> Date: 11 Apr 90 17:19:24 GMT References: Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Distribution: comp Organization: Microsoft Corp., Redmond WA Lines: 13 In article chin@sg1.chem.upenn.edu (Chin Wu) writes: > If we use a Base pointer to construct a Derived object, will the >Derived destructer be used when been deleted? Yes -- Iff you tell the compiler that you want polymorphic behavior for the destructor functions by declaring them "virtual." In general, in C++, whenever you want the "correct" function called [explicetly or implicitly] through a pointer or reference of a type of a parent class, rather than a pointer or reference of the actual type of the object, and when you have differing versions of the function in the base and the derived classes --then you need to declare the functions involved "virtual."