Encapsulation helps hide implementation behind an interface (or API).
Encapsulated code has two features:
Instance variables are kept protected (usually with the private modifier).
Getter and setter methods provide access to instance variables.
IS-A refers to inheritance.
IS-A is expressed with the keyword extends.
IS-A, "inherits from," and "is a subtype of" are all equivalent expressions.
HAS-A means an instance of one class "has a" reference to an instance of another class.
English Premier League
Bundesliga
La Liga
Showing posts with label Encapsulation. Show all posts
Showing posts with label Encapsulation. Show all posts
11:58 AM
Encapsulation, IS-A, HAS-A
Friday, August 21, 2009
3:47 PM
Encapsulation
Thursday, August 20, 2009
Encapsulation is the process of grouping methods and data
together and hiding them behind a public interface. A class demonstrates good
encapsulation by protecting variables with private or protected access, while
providing more publicly accessible setter and/or getter methods
together and hiding them behind a public interface. A class demonstrates good
encapsulation by protecting variables with private or protected access, while
providing more publicly accessible setter and/or getter methods
Subscribe to:
Posts (Atom)

