Methods define the behavior of objects instantiated from a class. It is an object's methods that manipulate its instance variables. Unlike regular procedural languages, classes in an object-oriented language may have methods with the same names as other classes. A given object responds to a message in ways determined by the nature of that object, providing polymorphic behavior. Subclasses provide the means by which a new class can inherit instance variables and methods from any already defined class.
Subclasses provide code reuse.
Inc. All rights reserved.