Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!daver!tscs!tct!chip From: chip@tct.com (Chip Salzenberg) Newsgroups: comp.lang.c++ Subject: Re: typesafe downward casting Message-ID: <28045704.4BDB@tct.com> Date: 11 Apr 91 12:31:00 GMT References: <1991Apr5.150148.21840@kodak.kodak.com> <28007BC8.D71@tct.com> Organization: Teltronics/TCT, Sarasota, FL Lines: 19 According to Ari.Huttunen@hut.fi (Ari Juhani Huttunen): >>Somebody writes: >>>But another use of inheritance is to add functionality to an existing >>>class by deriving from it. ... In this context one must either have >>>contravariance on the return type of virtual functions or type-safe >>>down casting ... > >In article <28007BC8.D71@tct.com> chip@tct.com (Chip Salzenberg) writes: >>Or (another choice): modify the base class for the added functionality >>(add a do-nothing virtual function, etc). That's my choice. > >Is it still your choice if the base class is provided only in binary form? If I only have binaries, I refuse to inherit. I compose instead. It saves everyone a lot of trouble. -- Brand X Industries Custodial, Refurbishing and Containment Service: When You Never, Ever Want To See It Again [tm] Chip Salzenberg ,