from design standpointencapsulation also provides critical service of separating the concerns of "whatvs "how the actual implementation of an object is independent of its use the implementation can changebut as long as the interface is preservedother components that rely on the object will not break encapsulation allows us to isolate major design decisionsespecially ones that are subject to change another advantage of encapsulation is that it supports code reuse it allows us to package up general components that can be used from one program to the next the dieview class and button classes are good examples of reusable components encapsulation is probably the chief benefit of using objectsbut alone it only makes system object-based to be truly objected-orientedthe approach must also have the characteristics of polymorphism and inheritance polymorphism literallythe word polymorphism means "many forms when used in object-oriented literaturethis refers to the fact that what an object does in response to message ( method calldepends on the type or class of the object our poker program illustrated one aspect of polymorphism the pokerapp class was used both with textinterface and graphicsinterface there were two different forms of interfaceand the pokerapp class could function quite well with either when the pokerapp called the showdice methodfor examplethe textinterface showed the dice one way and the graphicsinterface did it another way in our poker examplewe used either the text interface or the graphics interface the remarkable thing about polymorphismhoweveris that given line in program may invoke completely different method from one moment to the next as simple examplesuppose you had list of graphics objects to draw on the screen the list might contain mixture of circlerectanglepolygonetc you could draw all the items in list with this simple codefor obj in objectsobj draw(winnow ask yourselfwhat operation does this loop actually executewhen obj is circleit executes the draw method from the circle class when obj is rectangleit is the draw method from the rectangle classetc polymorphism gives object-oriented systems the flexibility for each object to perform an action just the way that it should be performed for that object before object orientationthis kind of flexibility was much harder to achieve inheritance the third important property for object-oriented approachesinheritanceis one that we have not yet used the idea behind inheritance is that new class can be defined to borrow behavior from another class the new class (the one doing the borrowingis called subclassand the existing class (the one being borrowed fromis its superclass