Thursday, July 9, 2009

Calling the setter function of a POINTER to that class? C++ (details inside!!!)?

The class is called Grade_Integer


The setter function is set_grade()





When I perform the setter function on a type Grade_Integer, everything works fine.





example:





// Grade_Integer temp;


// temp.set_grade(0); %26lt;--- sets the grade to 0





However, I need to do this for a pointer to a type Grade_Integer, so that it looks like





// Grade_Integer *temp;


// temp.set_grade(0); %26lt;--- does not work!!!





How can I fix this line of code?

Calling the setter function of a POINTER to that class? C++ (details inside!!!)?
temp.set_grade(0);


should either be:


1.) (*temp).set_grade(0);


or 2.) temp-%26gt;set_grade(0);


No comments:

Post a Comment