C++

Thursday, 15 March 2012

Polymorphism

Another benefit of separating implementaion from behavior is polymorphism. Polymorphism allows two or more objects respond to the same message. A method called name could also be implemented for an object of the class Course. Even though the implementation of this name message may return a course number and a course title, its protocol is the same as the name message to the Student object. Polymorphism allows a sending object to communicate with different objects in a consistant manner without worrying about how many different implementations of a message.

No comments:

Post a Comment