🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

virtual operator+

#79
From: Christopher Deli
Date: Thu, 16 May 2002 21:17
17 lines
1808 bytes
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
and B so I could do the following:
A *a, *b, *c
a = new B(...)
b = new B(...)
c = new B(...)
*c = *a + *b
So I make a pointer of type A which points on an objekt of type B. For that
I'd need a virtual operator+ but I have no idea how to make it. Please help!
The source code of a program which has the similar situation would be
perfekt! Thanks!

// Christopher
Technical Details
Message-ID: <5mVE8.38287$n4.8427350@newsc.telia.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!TeliaNet!194.22.194.4.MISMATCH!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,e2ff40a616ce87ab,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: 10d4ba,e2ff40a616ce87ab,start
X-Google-Attributes: gid10d4ba,public
X-Google-Thread: 114592,e2ff40a616ce87ab,start
X-Google-Attributes: gid114592,public
X-Google-ArrivalTime: 2002-05-16 14:17:57 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!TeliaNet!194.22.194.4.MISMATCH!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail
From: "Christopher Deli" <christopher@delinfo.com>
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++
Subject: virtual operator+
Lines: 19
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: <5mVE8.38287$n4.8427350@newsc.telia.net>
Date: Thu, 16 May 2002 21:17:53 GMT
NNTP-Posting-Host: 212.181.175.29
X-Complaints-To: abuse@telia.com
X-Trace: newsc.telia.net 1021583873 212.181.175.29 (Thu, 16 May 2002 23:17:53 CEST)
NNTP-Posting-Date: Thu, 16 May 2002 23:17:53 CEST
Organization: Telia Internet