Containership: When an object of one class is created into another class then that object will be a member of that class, this type of… Read More
Tag Archives: Inheritance
Java is one of the most popular and widely used programming languages. Java has been one of the most popular programming languages for many years.… Read More
Base Class: A base class is a class in Object-Oriented Programming language, from which other classes are derived. The class which inherits the base class… Read More
Inheritance: When we want to create a new class and there is already a class that includes some of the code that we want, we can… Read More
Prerequisite – Association, Composition and Aggregation in Java Association: An association is defined as an organization of people with a common purpose and having a… Read More
Object-oriented design started right from the moment computers were invented. Programming was there, and programming approaches came into the picture. Programming is basically giving certain… Read More
Recently, BA Continuum India visited our campus for recruitment. There were total 4 rounds. Round 1: This round was a general aptitude test, which consisted… Read More
Consider the below C++ program. #include<iostream> using namespace std; class A { public: A(){ cout <<"1";} A(const A &obj){ cout <<"2";} }; class B:… Read More
final class Complex { private final double re; private final double im; public Complex(double re, double im) { this.re = re; this.im =… Read More
Predict the output of following Java Program // filename Main.java class Grandparent { public void Print() { System.out.println("Grandparent's Print()"); } } class Parent extends… Read More
Which of the following is true about inheritance in Java. 1) In Java all classes inherit from the Object class directly or indirectly. The Object… Read More
Predict the output of following program. Note that foo() is public in base and private in derived. class Base { public void foo() { System.out.println("Base");… Read More
#include<iostream> using namespace std; class Base1 { public: char c; }; class Base2 { public: int c; }; class Derived: public Base1,… Read More
#include<iostream> using namespace std; class Base { protected: int a; public: Base() {a = 0;} }; class Derived1: public Base { public: int… Read More
#include<iostream> using namespace std; class Base { public : int x, y; public: Base(int i, int j){ x = i; y = j; }… Read More