Path: utzoo!attcan!uunet!cs.utexas.edu!milano!cadillac!vaughan@mcc.com From: vaughan@mcc.com (Paul Vaughan) Newsgroups: comp.lang.c++ Subject: Re: CastDown vs. Virtuals Message-ID: <8828@cadillac.CAD.MCC.COM> Date: 8 Jun 90 19:59:24 GMT References: Sender: news@cadillac.CAD.MCC.COM Reply-To: vaughan@mcc.com (Paul Vaughan) Distribution: comp Organization: MCC VLSI CAD Program Lines: 18 In-reply-to: aaron@rruxh.UUCP (Akman) As long as there is a generic base class that describes the mutual properties of all possible derived classes, that should be sufficient (and object oriented). Yes? No? Not quite. The problem is that there will be properties of some possible derived classes that you will want to access that are not mutual properties of all possible derived classes. If you have code that works with the base class and passes these base class pointers to code that really wants to assume more so that it can access these more specific properties, then you will need to cast down (and perhaps first verify that the cast is valid). If you had omitted the word "mutual," then it would be sufficient, but not object oriented. Paul Vaughan, MCC CAD Program | ARPA: vaughan@mcc.com | Phone: [512] 338-3639 Box 200195, Austin, TX 78720 | UUCP: ...!cs.utexas.edu!milano!cadillac!vaughan