|
-
Jun 8th, 2004, 06:25 PM
#1
Thread Starter
Fanatic Member
Class operators [RESOLVED]
Say that we had a class, A, in which is defined as such:
Code:
class A
{
public:
A& operator=(const A& rhs);
A operator+(const float &rhs) const;
}
Now this would allow us to do things such as:
How could we make it so that:
would be valid?
Last edited by Darkwraith; Jun 8th, 2004 at 08:28 PM.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
-
Jun 8th, 2004, 07:26 PM
#2
Code:
class A
{
// ...
friend A operator+(float f, const A& a);
}
A operator+(float f, const A& a)
{
// ....
}
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Jun 8th, 2004, 08:27 PM
#3
Thread Starter
Fanatic Member
Thanks for all your help.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|