Skip to content


October 9, 2013

Polymorphism is the ability to redefine methods for derived classes. For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Polymorphism is considered to be a requirement of any true object-oriented programming language (OOPL) ( ref ). Its like subclasses and its superclasses using each other.


// initialized box and rect. 
// rectangle is a superclass and 
// box is the subcalss

Rectangle rect, rectRef;
Box box, 
// late binding :: a reference variable of
// a superclass can point to a subclass
// ( the class box ) 

rectRef = rect;
rectRef = box;

class diag

Class A is the superclass of B and C. Class B is the superclass of C.

Polymorphism Notes::

  1. a ref. var of the superclass(A) can pt. to the subclass(B and C).
  2. Class C can directly access public and protected members of its superclass(B and A)
  3. when a Class, method,  members is declared final, can’t be overriden, or be  a superclass.
  4. those declared private, final, or static methods can’t be used in late binding.



From → Classes, Discussion

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Children's Book Reviews

Malav Shah

official Web Site

My Road to Programming

The journey of how I taught myself to program.


Look at what's brewing up guys! we all are work in progress. So don't meander, lets micromesh everything and have candid conversation about every problem related to C, C++ and JAVA. We can rejuvenate the crinkled faces.


A simple guide to programming...


Information Techonology

Rahul's Work

My Work Tips and Tutorial on Various Tech.

Turnip Farmers

Kingdom Scans


Technology news, trends and analysis covering mobile, big data, cloud, science, energy and media

The Neighborhood

is under renovation in preparation for our 6th Season


News About Tech, Money and Innovation


The Diary of a Retiree

50 Year Project

My challenge to visit 192 countries, read 1,001 books, and watch the top 100 movies

[BTW] : Ben Trube, Writer

Writer, Programmer, Singer

My Arch Walkthrough

Arch linux made easy

Don Charisma

because anything is possible with Charisma

SutoCom Solutions

Success & Satisfaction with the Cloud

%d bloggers like this: