Posts

Runtime polymorphism

Polymorphism in Java  is a concept by which we can perform a  single action in different ways . Polymorphism is derived from 2 Greek words: poly and morphs. The word "poly" means many and "morphs" means forms. So polymorphism means many forms. There are two types of polymorphism in Java: compile-time polymorphism and runtime polymorphism. We can perform polymorphism in java by method overloading and method overriding. If you overload a static method in Java, it is the example of compile time polymorphism. Here, we will focus on runtime polymorphism in java.  Runtime polymorphism  or  Dynamic Method Dispatch  is a process in which a call to an overridden method is resolved at runtime rather than compile-time.  In this process, an overridden method is called through the reference variable of a superclass. The determination of the method to be called is based on the object being referred to by the reference variable.   Method overriding is an example...

Basic Concepts of Data Structure

Image
  Basic Concepts of Data Structure Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective way. Data Structures is about rendering data elements in terms of some relationship, for better organization and storage. For example, we have data player's name "Hitesh" and age 26. Here "Hitesh" is of  String  data type and 26 is of integer  data type. We can organize this data as a record like  Player  record. Now we can collect and store player's records in a file or database as a data structure. For example: "Gayle" 30, "Sachin" 31, "Parth" 33 In simple language, Data Structures are structures programmed to store ordered data, so that various operations can be performed on it easily. Data Definition Data Definition defines a particular data with following characteristics. Atomic  − Definition should define a single concept Traceable  − Definition should be be...

Inheritance in C++

                                                     Inheritance in C++  The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important feature of Object Oriented Programming.  Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.  Super Class:The class whose properties are inherited by sub class is called Base Class or Super class.  The article is divided into following subtopics:  Why and when to use inheritance? Modes of Inheritance Types of Inheritance Why and when to use inheritance? Consider a group of vehicles. You need to create classes for Bus, Car and Truck. The methods fuelAmount(), capacity(), applyBrakes() will be same for all of the three classes. If we create these classes avoiding...