Operator overloading for pointer to objects .

V

vivekian

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
 
N

Neelesh Bodas

vivekian said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top