Re: Virtual Constructor and Covariant Return Types
From: Alex Vinokur (alexvn_at_big.foot.com)
Date: 04/15/04
- Next message: Ioannis Vranos: "Re: Is it standard and practical to use long long types?"
- Previous message: neo88: "Re: What's wrong with this function"
- In reply to: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Next in thread: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Reply: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 15 Apr 2004 16:31:48 +0300
"Buster" <noone@nowhere.com> wrote in message news:c5m1oq$qfo$1@newsg3.svr.pol.co.uk...
> Alex Vinokur wrote:
>
> > Here is some program with virtual constructors.
> >
> > Is there any difference between
> > * clone1() vs. clone2()
> > * create1() vs. create2() ?
>
> [...]
>
> > // --- Covariant Return Types ---
> > Circle* clone1() const { return new Circle(*this); }
> > Circle* create1() const { return new Circle();}
> > // ------------------------------
> >
> > // --- NonCovariant Return Types ---
> > Shape* clone2() const { return new Circle(*this); }
> > Shape* create2() const { return new Circle();}
> > // ---------------------------------
>
> [...]
>
> Sorry, am I missing the point? You can see the what the difference is.
>
clone1() and create1() return Circle*,
clone2() and create2() return Shape*.
The question is if we can use
* create2() instead of create1(),
* clone2() instead of clone1()
with the same results.
--
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html
- Next message: Ioannis Vranos: "Re: Is it standard and practical to use long long types?"
- Previous message: neo88: "Re: What's wrong with this function"
- In reply to: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Next in thread: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Reply: Buster: "Re: Virtual Constructor and Covariant Return Types"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]