🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #83

Re: virtual operator+

#83
From: Victor Bazarov
Date: Thu, 16 May 2002 23:30
27 lines
2191 bytes
"Robert W Hand" <rwhand@NOSPAMoperamail.com> wrote...
> On Thu, 16 May 2002 21:31:31 GMT, "Daniel T." <notdanielt3@gte.net>
> wrote:
>
> >"Christopher Deli" <christopher@delinfo.com> wrote:
> >
> >>Hello!
> >>
> >>I have a problem which I'd need some help with, please.
> >>If I have one class A which is inherited by another class B i.e. class B
:
> >>public class A and I would like to make a virtual operator+ in both
class A
>
> >What is op+ supposed to return, an "A" object or a "B" object?
>
> Aren't the two return types A and B covariant?  The one in the A class
> would return an A object, and the one in the B class would return a B
> object.


No.  Covariance requires a pointer or a reference.  Operator +
returns an object, not a pointer and not a reference.

Victor
--
Please remove capital A's from my address when replying by mail
Technical Details
Message-ID: <%hXE8.41120$UV4.7489@rwcrnsc54>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail
References: <5mVE8.38287$n4.8427350@newsc.telia.net> <notdanielt3-34A906.17313116052002@news.bellatlantic.net> <ekf8eug9pmpefc11b5uv2t9a37ji28mq6d@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,e2ff40a616ce87ab
X-Google-Attributes: gid109fba,public
X-Google-Thread: 114592,e2ff40a616ce87ab
X-Google-Attributes: gid114592,public
X-Google-Thread: 10d4ba,e2ff40a616ce87ab
X-Google-Attributes: gid10d4ba,public
X-Google-ArrivalTime: 2002-05-16 16:30:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail
From: "Victor Bazarov" <vAbazarov@dAnai.com>
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++
References: <5mVE8.38287$n4.8427350@newsc.telia.net> <notdanielt3-34A906.17313116052002@news.bellatlantic.net> <ekf8eug9pmpefc11b5uv2t9a37ji28mq6d@4ax.com>
Subject: Re: virtual operator+
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <%hXE8.41120$UV4.7489@rwcrnsc54>
NNTP-Posting-Host: 12.236.143.17
X-Complaints-To: abuse@attbi.com
X-Trace: rwcrnsc54 1021591803 12.236.143.17 (Thu, 16 May 2002 23:30:03 GMT)
NNTP-Posting-Date: Thu, 16 May 2002 23:30:03 GMT
Organization: AT&T Broadband
Date: Thu, 16 May 2002 23:30:03 GMT