Card 6 / 125: What are the pros of encapsulation?
A)
avoid code duplicity
B)
prevent any inappropriate modification of an object's attributes
C)
other classes, which use a well encapsulated class,won't need to know the implementation details of this class
D)
subtypes of a well-encapsulated class won't need to override most of the inherited methods
E)
modifications to the implementation of the class, won't affect how other classes use the class, as long the interface between them kept unchanged
Answer:
B) prevent any inappropriate modification of an object's attributes
C) other classes, which use a well encapsulated class,won't need to know the implementation details of this class
E) modifications to the implementation of the class, won't affect how other classes use the class, as long the interface between them kept unchanged
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
private and restrict accessing them through public methods and also means hiding the internal implementation and representation of an object and provide to the outer world only an interface of public methods to access the object.
Answers: "avoid code duplicity " and "subtypes of a well-encapsulated class won't need to override most of the inherited methods ", have nothing to do with encapsulation