From -4254680877284545728
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ede379f5dbbc1549
X-Google-Attributes: gidf78e5,public
From: sbnaran@uiuc.edu (Siemel B. Naran)
Subject: Re: Suggestion: "typeof" keyword
Date: 1999/08/17
Message-ID: <slrn7rhj3f.700.sbnaran@localhost.localdomain>#1/1
X-Deja-AN: 513690525
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7nt3vl$1oe$1@nnrp1.deja.com> <7oh7o8$t3f$1@nnrp1.deja.com> <7ol6hi$ej9$2@news.BelWue.DE> <cTiioXAhAwr3Ew$X@robinton.demon.co.uk> <t7d7ww1vrz.fsf@calumny.jyacc.com> <e4DSyfA4ALs3Ew0Q@robinton.demon.co.uk> <t7r9laz5hj.fsf@calumny.jyacc.com> <7oup0a$8g2$1@nnrp1.deja.com> <37B2E9B8.491D@wanadoo.fr> <slrn7r5tnl.kn9.sbnaran@localhost.localdomain> <37B43D99.608A@wanadoo.fr> <7pa195$prj$1@nnrp1.deja.com>
X-Original-Date: 17 Aug 1999 05:01:09 GMT
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 934872218 10111 128.250.29.17 (17 Aug 1999 06:43:38 GMT)
Organization: University of Illinois at Urbana-Champaign
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN7kEi+EDnX0m9pzZAQGnIAGAlg4WDkhEYxaXNEOm1xvKxRhT/Xy+IlIs KYouGCzj6tVcsFr3L33FYIbNqeKIfWuN =qBjB
User-Agent: slrn/0.9.5.7 (UNIX)
Reply-To: sbnaran@uiuc.edu
NNTP-Posting-Date: 17 Aug 1999 06:43:38 GMT
Newsgroups: comp.std.c++

On 16 Aug 1999 23:20:20 GMT, sirwillard@my-deja.com
>  Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:

>> The object passed to the ctor is still a derived object.

>Is it?  By dereferencing a base pointer, did I not slice the object?

There was no slicing as you passed by reference.  To recap:
   struct base { virtual ~base(); base(const base&); };
   struct derived : base { };
   base::base(const base& b) { assert(typeid(b)==typeid(derived); }
   int main() { base * b=new derived; typeof(*b) copy(*b); delete b; }
The assertion will be true, at least in my rules of 'typeof'.

-- 
----------------------------------
Siemel B. Naran (sbnaran@uiuc.edu)
----------------------------------
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



