nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Übergabe von this?

Von: Robert Hartmann (robert_hartmann@gmx.net) [Profil]
Datum: 15.06.2009 12:06
Message-ID: <h156e8$11nh$1@ariadne.rz.tu-clausthal.de>
Newsgroup: de.comp.lang.iso-c++
Hallo zusammen,

Ich würde gerne an eine constante Referenz this übergeben,
aber irgendwie bekomme ich das Zusammenspiel nicht hin.

Sicherlich sollen die Methoden was anderes machen als unten
angegeben, aber das Problem ist erstmal die Übergabe von this.


class MyClass1{

static int foo (const MyClass2& A, const MyClass2& B, )
{ return (A.stat + B.stat);}
}


class MyClass2{
public:
int stat;
void bar(const MyClaas2&B ) const {int i = MyClaas1.foo(this, B );}

}

Gruß Robert

[ Auf dieses Posting antworten ]

Antworten