What is encapsulation? Well, in a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. First, lets define accessors and mutators:
Accessor
An accessor is a method that is used to ask an object about itself. In OOP, these are usually in the form of properties, which have, under normal conditions, a get method, which is an accessor method.
However, accessor methods are not restricted to properties and can be any public method that gives information about the state of the object.
Mutator Mutators are public methods that are used to modify the state of an object, while hiding the implementation of exactly how the data gets modified. Mutators are commonly another portion of the
property discussed above, except this time its the set method that lets the caller modify the member data behind the scenes.
This type of data protection and implementation protection is called Encapsulation.
Inheritance::Declaration options, such as Public and Private, dictate which members of a superclass can be inherited. For more information on this, see the Declaration Option section of Eric's post.
Polymorphism:: There are 2 basic types of polymorphism. Overridding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism. This difference is, for method overloading, the compiler determines which method will be executed, and this decision is made when the code gets compiled. Which method will be used for method overriding is determined at runtime based on the dynamic type of an object.
♥ ¸¸.•*¨*•♫♪♪♫•*¨*•.¸¸♥
http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/
No comments:
Post a Comment