Features of Object Orientation
Abstraction
When you go to buy a washing machine, you will concentrate on the features that a particular brand of washing machine offers, like the wash mode and the color, in the context of your requirements. However, if an engineer comes home to repair your washing machine, he would concentrate on the “inside” of the machine, the working of the different components of the machine, and the item code of the part to be replaced.
Here, you as a user of the washing machine concentrate on the essential attributes and behaviors from your point of view, whereas the engineer views the washing machine at a different level of detail.
Abstraction, therefore, represents the essential characteristics of an object/class that differentiates it from other objects/classes with respect to the viewer’s perspective.
Inheritance
Inheritance is a mechanism, which helps you to generalize common attributes and behaviors in separate classes from which various subclasses can be derived.
For example, the “Automatic Washing Machine” class is a subclass of the “Washing Machine” class and needs to contain only those attributes and behaviors that are specific to it. Other attributes and behaviors can be inherited from the “Washing Machine” class.
Encapsulation
Encapsulation helps you to hide unnecessary behaviors/attributes from the user and show only those attributes/behaviors that the users can directly use.
For example, the users of the washing machine need not know the intricacies of the internal working of the washing machine. They only need to know certain functions like switch on/off, wash mode settings etc.
Polymorphism is the ability of an object to behave differently under different circumstances.
For example, Joseph Picardo’s washing machine is an object of the “Washing machine” class. It behaves differently based on the mode setting. If the mode setting is “Wash”, the machine carries out the washing operation, whereas if the mode setting is “Spin Dry” a different action is performed.
Related Articles
- Advantages of Object Orientation Why do we opt for the object-oriented approach? The principal reasons are: - Realistic modeling Since we live in a world full of objects, it logically follows that
- Object Oriented Approach An object is one of the first things that an infant learns to recognize. The multitude of 'things' that hover above its crib, that smile and talk to it, that
- Xbox 360 Features - The Wonderful Characteristics Are you happy with the Xbox 360 features? I bet you are because the Xbox 360 features are very remarkable. These are what that can delight you in every game.
- Dog Training Schools: How to Choose dog trainingThe truth is there are so many dog courses that offer their services to anyone willing to pay them. The problem though is not all schools will meet your
- Solar Energy - The Future of Generating Energy For The Home Solar energy for home homes is nothing new. It has just been banished to the background in lieu of increasing cost of property ; more recent more advanced building materials,
- Used Solar Panels eBay: Methods To Build Your Own System The diy solar panels is one that is considered to be very important in today’s world. There is no better time than now to make the switch and start relying
- Omaha Poker Odds Calculator omaha indicatorIf you are like me and most on-line poker players, you have probably seen a lot of felt with 2 hole cards (Texas Holdem). Whether you are an experienced
- Portrait Photography Portrait lightingDo you just snap pictures of friends without a thought to how it my turn out? Executive portrait photography takes you a step up from people photography. It gives
Comments
Leave a Reply