Polymorphism allows you define one interface and have multiple implementation. This example demonstrates polymorphism.
Polymorphism allows you define one interface and have multiple implementation. This example demonstrates polymorphism.
In case of method overriding, the method in super class is hidden by the sub-class method. This example demonstrates how to use super() to call the super classes method.
Cloning an object means, creating a copy of object. This example demonstrates constructing clone of an object.
This example demonstrates a complete implementation of a derived class.
In this, objects 'weightbox' and 'plainbox' are created from the classes BoxWeight and Box respectively.
In this example, the class Box is extended by class ColorBox in order to add color variable for each box.