C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

friend in Member-Functions

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Pascal Steiss
Guest





PostPosted: Thu Apr 01, 2004 4:52 pm    Post subject: friend in Member-Functions Reply with quote



Hallo NG

Ich habe mich gefragt, was das zu bedeuten hat (entstammt der
Bibliothek 'matpack'):
-- snip --
class Trafo
{
protected:
float m[3][4];

public:
Trafo (void) {}
Trafo (float);

enum { XAxis = 1, YAxis = 2, ZAxis = 3 }; // axes for rotations

const float& operator () (int i, int j) const { return m[i][j];
}
float& operator () (int i, int j) { return m[i][j]; }

friend Trafo operator * (const Trafo&, const Trafo&);
********
friend Trafo invert (const Trafo&);
friend Trafo trans (float tx,float ty, float tz);
friend Trafo scale (float sx, float sy, float sz);
friend Trafo scale (float s);
friend Trafo rot (int axis, float theta);
friend Trafo rot
(float,float,float,float,float,float,float);
friend Trafo rot (const Vector3D& axis, float theta);
********
friend bool operator == (const Trafo& a, const Trafo& b);
....
-- snap --

Was bedeutet diese friend Trafo rot etc.? Deklarationen von
Member-Functions scheinen die nicht zu sein...
Ich kenn' das nur im Zusammenhang, wenn abgeleitete Klassen auf die
Protected-Felder zugreifen sollen...

Gruss
Pascal

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Rolf Magnus
Guest





PostPosted: Thu Apr 01, 2004 5:49 pm    Post subject: Re: friend in Member-Functions Reply with quote



Pascal Steiss wrote:

Quote:
Hallo NG

Ich habe mich gefragt, was das zu bedeuten hat (entstammt der
Bibliothek 'matpack'):
-- snip --
class Trafo
{
protected:
float m[3][4];

public:
Trafo (void) {}
Trafo (float);

enum { XAxis = 1, YAxis = 2, ZAxis = 3 }; // axes for rotations

const float& operator () (int i, int j) const { return m[i][j];
}
float& operator () (int i, int j) { return m[i][j]; }

friend Trafo operator * (const Trafo&, const Trafo&);
********
friend Trafo invert (const Trafo&);
friend Trafo trans (float tx,float ty, float tz);
friend Trafo scale (float sx, float sy, float sz);
friend Trafo scale (float s);
friend Trafo rot (int axis, float theta);
friend Trafo rot
(float,float,float,float,float,float,float);
friend Trafo rot (const Vector3D& axis, float theta);
********
friend bool operator == (const Trafo& a, const Trafo& b);
...
-- snap --

Was bedeutet diese friend Trafo rot etc.? Deklarationen von
Member-Functions scheinen die nicht zu sein...

Es sind friend-Deklarationen von nicht-Member-Funktionen. Genauso, wie
auch der operator* davor und der operator== danach.

Quote:
Ich kenn' das nur im Zusammenhang, wenn abgeleitete Klassen auf die
Protected-Felder zugreifen sollen...

Wo braucht man da friend?

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.