|
-
Apr 25th, 2002, 08:00 PM
#1
Thread Starter
Fanatic Member
= operator overload
whats the syntax for overloading the = operator?
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Apr 26th, 2002, 09:45 AM
#2
Code:
class Something
{
Something& operator = (const argtype &arg);
};
is the usual way. The last statement should be
return *this;
This way you can do
Something o1, o2, o3;
o1 = o2 = o3 = 234;
You can define as many different = operators as you want, as long as they can be distinguished by the compiler.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 26th, 2002, 02:41 PM
#3
Thread Starter
Fanatic Member
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
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
|