By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,379 Members | 1,602 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,379 IT Pros & Developers. It's quick & easy.

Operator overloading for pointer to objects .

P: n/a
Have a pointer to an object of class type task

task * A ;

Now this object takes operator overloading like

A<<2 ;

which assigns the number 2 to one of the members of the object A.

Is there a way to do this with the pointer to the object ?

Thanks ,
vivekian

Dec 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
vivekian wrote:
Have a pointer to an object of class type task

task * A ;

Now this object takes operator overloading like
it doesnot make sense to say "an object takes operator overloading".
Perhaps you mean that operator<< is overloaded for class task.
A<<2 ;

which assigns the number 2 to one of the members of the object A.

Is there a way to do this with the pointer to the object ?


While oveloading any operator, atleast one argument must be of user
defined type. So operator<<(task*, int) is an incorrect overloading.
Hence A<<2 will also not work

Hope that helps.

Dec 11 '05 #2

P: n/a
Thanks

Dec 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.