Polymorphism, Encapsulation and Inheritance Work Together
By: aathishankaran
Polymorphism, Encapsulation and Inheritance Work Together
When
properly applied, polymorphism, Encapsulation and Inheritance combine to produce
a programming environment that supports the development of far more robust and
scaleable programs than does the process-oriented model.
A
well-designed hierarchy of classes is the basic for reusing the code in which
you have invested time and effort developing and testing. Encapsulation allows
you to migrate your implementations over time without breaking the code that
depends on the public interface of your classes. Polymorphism allows you to
create clean, sensible, readable and resilient code.
The
final attribute, polymorphism, is clearly reflected in the ability of car
manufacturers to offer a wide array of options on basically the same vehicle.
For
example, you can get an antilock braking system or traditional brakes, power or
rack-and-pinion steering, 4,6 or 8 cylinder engines. Either way, you will still
press the break pedal to stop, turn the steering wheel to change direction and
press the accelerator when you want to move. The same interface can be used to
control a number of different implementations.
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. Lidia
View Tutorial By: money tree at 2012-06-25 23:09:51