11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

182Part III: Introduction to ClassesEach call made from main() is noted in the comments with the extendedname of the function called.When calling overloaded functions, not only the arguments of the functionbut also the type of the object (if any) with which the function is invoked areused to disambiguate the call. (The term disambiguate is object-oriented talkfor “decide at compile time which overloaded function to call.” A mere mortalmight say “differentiate.”)In the example, the first two calls to the member functions,Student::grade(float) and Student::grade(), are differentiated bytheir argument lists and the type of object used. The call to s.grade() callsStudent::grade() because s is of type Student.The third call has no object, so it unambiguously denotes the non-memberfunction ::grade(float).The final call is made with an object of type Slope; it must refer to themember function Slope::grade().

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!