 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pascal Steiss Guest
|
Posted: Thu Apr 01, 2004 4:52 pm Post subject: friend in Member-Functions |
|
|
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
|
Posted: Thu Apr 01, 2004 5:49 pm Post subject: Re: friend in Member-Functions |
|
|
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 |
|
 |
|
|
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
|
|