Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!islsun!cok From: cok@islsun.Kodak.COM (David Cok) Newsgroups: comp.lang.c++ Subject: Re: typesafe downward casting and contravariance Message-ID: <1991Apr12.100854.18729@kodak.kodak.com> Date: 12 Apr 91 10:08:54 GMT References: <9104111419.AA08217@ucbvax.Berkeley.EDU> Sender: news@kodak.kodak.com Organization: Eastman Kodak Co., Rochester, NY Lines: 33 In article <9104111419.AA08217@ucbvax.Berkeley.EDU> schweitz@lexvmc.vnet.ibm.com ("Eric Schweitz") writes: .... >Sigh. Sorry for my poor example. It seems to have clouded rather than >clarified my point. I should have wrote: > > int sin (number); > float sin (number); > complex sin (number); > >or even better just used something generic: > > base func (base); > derived func (base); > morederived func (base); > ..... >(Does this impose the restriction >that sizeof(derived*) == sizeof(base*)? Note: This isn't an attack, >I'm just curious. :-)) The above would not be allowed either. a) There is not enough info to disambiguate; b) the return types are not pointers or references. What would be allowed is this: base* base::func(); derived* derived::func(); morederived* morederived::(); There is no need for the restriction on sizes. David R. Cok Eastman Kodak Company -- Imaging Science Lab cok@Kodak.COM