🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.c++
Article #2003

Re: Brauch Hilfe bei Container-Arrays ???

#2003
From: Ralf W. Stephan
Date: Thu, 04 Apr 1996 13:34
23 lines
1361 bytes
Christian Groeling writes:
> ich wollte eigentlich nur erklärt haben warum der unten aufgeführte
> Teil eines C++ Listings die Zeile " int operator==(const Position& mc)
> const{} " braucht (und warum). Ich weiss es hat irgendetwas mit einem
> Copy Konstruktor zu tun. 

Wenn ja, dann sollte es wohl so aussehen:
Position (const Position& mc) { xz = mc.xz; yz = mc.yz; }

Oder meinst Du den Zuweisungsoperator?  Dann wäre das:
Position& operator=(const Position& mc) 
                              { xz = mc.xz; yz = mc.yz; return *this; }

Oder meinst Du wohl doch den Vergleichsoperator, dann eben:
bool operator==(const Position& mc) const { return xz==mc.xz && yz==mc.yz; }


ralf
--
"In some ways the online environment in 1996 feels like Hong Kong in the 
last days of British rule: a very free community wondering what's going to 
happen as the forces of law and order start moving in." --Charles Platt   
PGP: 1024/0xA713ECE9 2047/0xC8E605F5    keys on servers
Technical Details
Message-ID: <1996Apr4.133448.1130@ark.franken.de>
Path: arc1-ca.pugleaf.net!ark.franken.de!ralf
References: <4julhd$dg@station1.compoint.de>

Show Full Headers
Complete Article Headers
Newsgroups: de.comp.lang.c++
Path: arc1-ca.pugleaf.net!ark.franken.de!ralf
From: ralf@ark.franken.de (Ralf W. Stephan)
Subject: Re: Brauch Hilfe bei Container-Arrays ???
Message-ID: <1996Apr4.133448.1130@ark.franken.de>
Organization: his desk writing an article
Date: Thu, 4 Apr 1996 13:34:48 GMT
References: <4julhd$dg@station1.compoint.de>
X-Newsreader: TIN [version 1.2 PL2]