1. When an object is created and initialized with another object, as shown in the example below -
INFO Y(X);
Here, class is INFO, Y is the object being created and X is the object being used to initialize it.
2. When an object is passed by value to a function.
func(ob); - function call, an object being passed
3. When a function returns an object.
ABC func2( ); - prototype of a function that returns an object of class ABC
A constructor obeys all the access rules. When declared under private, it will be available to other members of the class only. Thus, member functions can declare objects. The same also applies to friend functions as they can also access private members of a class.
The constructor may be called implicitly or explicitly -
Implicit Call to the Constructor – Here, the constructor is not called by name but is invoked automatically. It initializes the object with the passed values.
Example : for a class named INFO, the statement below will implicitly call the constructor.
INFO X(12,’A’);
Explicit Call to the Constructor – Here, the constructor is called by name to initialize the object with the passed values.
Example : for a class named INFO, the statement below will explicitly call the constructor.
INFO Y=INFO(12,'A');
The default constructor doesn't accept any arguments. However, the class can have a constructor with default arguments too. In case values are not provided while creating the object, the constructor with default values can provide values.
Example -
class ABC{
int a;
int b;
public:
void show(){
cout<<"A = "<< a<<"B = "<< b;
}
ABC( ){a=123;b=345; } //default constructor
ABC(int x=55, int y=88){a=x; b=y;} // constructor with default arguments.
};
void main(){
ABC ob; //default constructor called ? or one with default arguments?
ob.show();
}
Constructors are special member functions. Their characteristics are –
1. Same name as the class
2. Invoked automatically when objects are created
3. Return type is not specified for constructors
4 Constructors cannot be static
5. Constructors cannot be inherited
6. Normally the constructor is called implicitly but it can be called explicitly too.
A. can access private members of base class.
B. can access protected members of base class.
C. cannot access private or protected members of base class.
D. cannot access public members of base class.
The private members of the base class are never accessible outside the class. The protected members of the base class are accessible only to the derived classes.
A. the size of data members in the base class.
B. the size of data members in the derived class.
C. the sum of sizes of data members in base class and the derived class.
D. 20 bytes always.
Derived class inherits all the properties of base class and add some features of its own.
A. the class sales and item has been derived from class xyitem.
B. the class sales has been derived from two classes, xyitem and item.
C. the class xyitem and item has been derived from class sales.
D. the class xyitem has been derived from two classes, item and sales.
xyitem is a subclass, derived from item and sales.
A. Base class
B. Derived class
C. Abstract class
D. Extended class
Abstract class is a class which is served as a base class only. It is not possible to create object of abstract class.
A. the base class constructor.
B. the base class members.
C. the abstract class.
D. the friend function.
The derived class constructor is responsible for invoking( and passing arguments to) the base class constructor.
A. the derived class automatically changes its name.
B. the base class is deleted.
C. the base class remains unchanged.
D. these changes are reflected in the base class too.
The process of creating new class, called derived class, from the existing old one, called base class, is known as inheritance. The derived classes inherit all the properties of base class and can add features of its own.
A. containership.
B. polymorphism.
C. inheritance.
D. encapsulation.
Creation of an object that contains another object is very different than the creation of an independent object. The other terms for containership are aggregation, containment, composition or nesting.
A. nesting of classes.
B. nesting of objects.
C. inheritance of class.
D. polymorphism of class.
In such a situation, the contained objects are constructed first and then the objects of the enclosing class are constructed.
One of the main advantages is code reusability. Once a class has been satisfactorily defined, it can be used in other classes without making changes. It represents real world entities very effectively – class Person can have features that can be inherited by Employee as well as Student.
Inheritance is one of the basic concept of Object Oriented Programming. It is the capability of one class to inherit properties from another class.
In the first statement, class P is inherited in private mode. Thus inheritable public and protected members of P become private members of S1. Private members can be accessed only by other members or friends of the class, not by the objects.
In the second statement, class P is inherited in public mode. Thus inheritable public and protected members of P become members of S2, with the same accessibility. Protected members can be accessed only by other members but the public members will be accessible by the objects.
class A : public B{ int x;
…..
public:
A( int a, int b, int c) : B(a, b)
{ x = c; }
……..
};
When a class inherits from multiple base classes, it can lead to an ambiguous situation. This is possible when the base classes themselves are derived from a common base class.
As shown in the figure, A is a base class from which two classes are derived, B and C. These further act as base classes for D.

Let us now try to visualize the problem that can arise. D wants to access a function which is inherited from base class A, into B and C. Obviously, since D is inheriting from both B and C, it receives two copies of the members they inherited from their base class A.
When this member is accessed, the compiler faces an ambiguous situation, which can be resolved in two ways.
One way out is to call the member with the class name i.e. B :: member or C :: member so that it is clear which member is being accessed.
The other way is to make the common base class (here, A) virtual, as shown in the example below.
class A
{ ….
public :
int a;
};
class B : public virtual A
{ ….
public :
int b;
};
class C : public virtual A
{ ….
public :
int c;
};
class D : public B, public C
{ ….
public :
int c;
};
Now, because of the keyword virtual, classes B and C will share a single common base class member,i.e., a. Thus there will be no ambiguity when accessing it.
When a class is defined inside another class, it is a nested class. This is different from Inheritance. Members of the nested class can access its other members and object of the nested class can access its public members. Similarly, members of the outside class can access other members and the object can access public members. We cannot say that members of one class become members of another class. Public members of the nested class can still only be called by its objects. If they were inherited, objects of the derived class would be able to call them too.
When a class inherits from another class, the derived class has IS-A relationship with its base class.
When a class contains object of another class-type, then containing/enclosing class has HAS-A relationship with contained/enclosed class.
When a class contains objects of other class types as its member, it is referred to as Containership or Containment or Aggregation. Containership is very different from Inheritance. In Inheritance, we have a class that has its own features in addition to some features of another class. Through Containership we can create a class containing object of another class type.
Private members cannot be inherited. However, other member functions that access the private members can be inherited. Thus, private members can be indirectly accessed through inherited functions.
Visibility modes are used to specify how the features of the base class are inherited into the derived class. The three visibility modes are public, private and protected. The inheritable base class members are placed under the access specifiers in the derived class depending on the visibility mode and its own access specifier.
The different forms of inheritance are as follows -
(i) Single Inheritance
(ii) Multiple Inheritance
(iii) Hierarchical Inheritance
(iv) Multilevel Inheritance
(v) Hybrid Inheritance
a) Line 14, a1 is a private member of A, so cannot be accessed
b) Line 24, a1 is a private member of A, so cannot be accessed
c) Line 33, a1 is a private member of A, so cannot be accessed
d) Line 34, a2 is a protected member of B, so cannot be accessed
e) Line 37, a1 is a private member of A, so cannot be accessed
f) Line 38, a2 is a private member of C, so cannot be accessed
g) Line 39, a3 is a private member of C, so cannot be accessed
#include < iostream.h>
class A{
public :
int h;
int b;
};
class Rectangle : public A
{
public:
Rectangle(int x, int y){
h = x;
b = y;
}
void calcarea(){
int a=h * b;
cout<<"Area of the rectangle = "<< a;
}
};
class Triangle : public A
{
public:
Triangle(int x, int y){
h = x;
b = y;
}
void calcarea(){
float a=(h * b)*0.5;
cout<<"Area of the Triangle = "<< a;
}
};
void main(){
Triangle ot(11,9);
Rectangle or(12,8);
ot.calcarea();
or.calcarea();
}
As you know, constructors and destructors are not inherited. A derived class has its own members along with inherited members. An object of the derived class will have its own data members and it will be built upon the data members inherited from the base class. To create an object, the constructor must be called.
If the base class has a constructor that accepts arguments (i.e. parameterized constructor) then the derived class should have a constructor that passes the arguments to the base class constructor. If the base class has only default constructors, then the derived class need not have a constructor.
The example below shows single inheritance in private visibility mode, where the base class constructor takes an argument. The derived class has a constructor that invokes the base class constructor and passes on the value to it.
Remember, to create an object, first the constructor of the base class and then the constructor of the derived class will be called.
When an object is destroyed, first the derived class destructor is invoked and then the base class destructor.
#include < iostream.h >
class P{ //base class P
int a;
public:
P(int x){ a=x; // constructor takes 1 argument
cout<<"a = "<< a;
}
void getdat(){
cout<<"a = ";
cin>>a;
}
void dispdat(){
cout<< a;
}
};
class E : private P{ //derived class E
int c;
public:
E(int x, int y) : P(x) //constructor invokes base class constructor
{ c=y; }
void getdata(){
cout<<"c = ";
cin>>c;
getdat();
}
void dispdata(){
cout<< c ;
dispdat();
}
};
void main()
{
E e(12,34);
e.getdata();
e.dispdata();
}
The visibility mode specifies whether features of the base class are derived publicly, privately or in protected mode. This controls the access of the inherited members in the derived class.
Public visibility mode – Inheritable public members of base class become public members of the derived class and protected members of base class become protected members of the derived class. Private members are not inherited.

Protected visibility mode - Inheritable public members and protected members of base class become protected members of the derived class. Private members are not inherited.
Private visibility mode - Inheritable public members and protected members of base class become private members of the derived class. Private members are not inherited.

The different forms of inheritance are
Single – When a subclass inherits from only one base class.

The syntax in single inheritance is –
class derived_class_name : visibility_mode base_class_name
{
……………. // members of the derived class
}
Multiple - When a subclass inherits from multiple base classes.
The syntax in multiple inheritance is –
class derived_class_name : visibility_mode base_class_name1, visibility_mode base_class_name2 [,visibility_mode base_class_name1, … ]
{
……………. // members of the derived class
}
Multilevel - When a subclass inherits from a class which inherits from another class.
The general form of multilevel inheritance is –
class derived_class_name1 : visibility_mode base_class_name
{
……………. // members of the derived class
}
class derived_class_name2 : visibility_mode derived_class_name1
{
……………. // members of the derived class
}
Hierarchical - When many subclasses inherit from one base class.

The general form of inheritance is –
class derived_class_name : visibility_mode base_class_name
{
……………. // members of the derived class
}
Hybrid – A combination of 2 or more forms, like when a subclass inherits from multiple base classes and the base classes inherit from a single base class.
![]()

#include< iostream.h >
class Building{
int floors;
int rooms;
public :
void getd(){
cout<<"nNo. of Floors = ";
cin>>floors;
cout<<"nNo. of Rooms = ";
cin>>rooms;
}
void dispd(){
cout<<"nNo. of Floors = "<< floors;
cout<<"nNo. of Rooms = "<< rooms;
}
};
class Flats : public Building{
int baths;
int terraces;
public :
void getdat(){
getd();
cout<<"nNo. of Bathrooms = ";
cin>>baths;
cout<<"nNo. of Terraces = ";
cin>>terraces;
}
void dispdat(){
dispd();
cout<<"nNo. of Bathrooms = "<< baths;
cout<<"nNo. of Terraces = "<< terraces;
}
};
class Offices : public Building{
int firexits;
public :
void getdata(){
getd();
cout<<"nNo. of Fire Exits = ";
cin>>firexits;
}
void dispdata(){
dispd();
cout<<"nNo. of Fire Exits = "<< firexits;
}
};
void main(){
Flats of;
Offices oo;
of.getdat();
of.dispdat();
oo.getdata();
oo.dispdata();
}
a) Base class is A and derived class is V for class H
b) Protected members are v2, getV(), h3,h4, getH(), a1, a2, getA(), dispA()
c) Function getV() can access v1, v2, h3, h4, a1,a2
d) Objects of class V can access dispV() and dispH()
a) Base class is Vehicle and derived class is Van for class Heavy
b) Function dispdata() can access getdata(), getd(), dispd(), getdat() and dispdat()
c) Objects of class Heavy can access getd() and dispd()
d) Objects of class Van can access getdata() and dispdata()
A. ifstream.
B. ofstream.
C. fstream.
D. instream.
The ofstream function provides an interface to write data to files as output streams.
A. public and protected members become private members in the derived class
B. private, public and protected members become private, public and protected members respectively in the derived class
C. private and protected members become private members in the derived class
D. public and protected members become public and protected members respectively in the derived class
The private derivation means, the derived class can access the public and private members of the base class privately.
A. private, public and protected members become public members in the derived class
B. public and protected members become public and protected respectively in the derived class
C. private, public and protected members are inherited under their own access labels
D. private and protected members become public and protected members respectively in the derived class
The public derivation means that the derived class can access the public and protected members of the base class but not the private members of the base class.
A. public, personal and protected
B. personal, private and protected
C. public, private and protected
D. public, private and personal
The visibility modes controls the visibility and availability of inherited base class members in the derived class. C++ provides three types of visibility modes - public, private and protected.
A. derived class
B. base class
C. abstract class
D. nested class
A new class can be derived from an existing class. Then the new derived class is called derived class or subclass and the existing class is called base class or super class.
A. the class that contains constructors
B. the class that contains public functions
C. the class that inherits features
D. the class from which features are inherited
A new class can be derived from an existing class. The new derived class is call derived class or subclass and the existing class is called base class or super class.
A. subclasses of X will automatically inherit features of class Y
B. subclasses of X will not automatically inherit features of class Y
C. subclasses of Y will automatically inherit features of class X
D. some subclasses of Y will inherit features of class X automatically
As X become subclass of Y, it could access features of class Y.
A. Multiple inheritance
B. Multilevel inheritance
C. Hierarchical inheritance
D. Single inheritance
Hierarchical inheritance is a method of inheritance where one or more derived classes (subclasses) are derived from a common base class.
A. multiple inheritance
B. multilevel inheritance
C. hierarchical inheritance
D. single inheritance
The transitive nature of inheritance is reflected by this form of inheritance. When a subclass inherits from a class that itself inherits from another class, it is known as multilevel inheritance.
A. multiple inheritance
B. multilevel inheritance
C. hierarchical inheritance
D. single inheritance
When a sub class inherits from multiple base classes, it is known as Multiple Inheritance.
A. multiple inheritance
B. multilevel inheritance
C. hierarchical inheritance
D. single inheritance
When a subclass inherits only from one base class, it is known as Single Inheritance.
A. no access to members
B. access to private members
C. code reusability
D. error handling
Through Inheritance features of one class could get accessed in another class.
A. Abstraction
B. Inheritance
C. Encapsulation
D. Data hiding
Inheritance is the basic feature of OOPs using which one class can inherits the properties or features of another class.
A. members are to be inaccessible from outside.
B. members are to be inheritable but inaccessible from outside.
C. members are to be inherited further.
D. members are not to be inherited.
When a base class is inherited with protected visibility mode the protected and public members of the base class become protected members of the derived class.
A. public, personal and protected
B. personal, private and protected
C. public, private and protected
D. public, private and personal
public --> Inherits the protected members as protected in derived class and pubic members will be public in derived class protected --> pubic and protected members of the base class will become protected in derived class Private --> public and protected members will become private in derived class
A. derived class
B. base class
C. abstract class
D. nested class
New classes can be derived from existing classes using a mechanism called "inheritance". The class that inherits the properties from base class is called derived class.
Private members can be used by the member functions of the same class whereas Protected members could get accessed by the derived class as well.
Abstract class is used as a blueprint in C++ where declaration of data members or member functions takes place. It is serve as a base class from which other classes could get derived. Objects for abstract class are not created.
The Constructors and Destructors of base class are not inherited.
Data Members - Static data members of the base class are not inherited.
Member Functions - Constructors and Destructors of base class are not inherited.
An existing class can be used to derive a new class. The existing class, whose properties are inherited is the base class and the class that inherits features is the derived class.
A. class derived –class-name : visibility-mode base class name{ : // members of derived class };
B. class derived –class-name ;visibility-mode base class name{ : // members of derived class };
C. class derived –class-name ; visibility-mode base class name{ ; // members of derived class };
D. class derived –class-name : { : // members of derived class };
The colon indicates that sub class is based upon the super class.
A. polymorphism.
B. inheritance.
C. abstraction.
D. encapsulation.
Inheritance is the capability of one class to inherit the properties of another class.
Example: class cars inherit the properties from automobiles, which itself inherited from another class vehicles.
A. private inheritance.
B. public inheritance.
C. protected inheritance.
D. general inheritance.
There are two types of relationship does exist between two classes - IS-A and HAS-A relationship
A. multiple inheritance.
B. multilevel inheritance.
C. hierarchical inheritance.
D. single inheritance.
In multilevel inheritance, a derived class itself acts as a base class for another class.
A. of the derived class will be called by an object of the base class.
B. of the derived class will be called by an object of the derived class.
C. of the base class will be called by an object of derived class.
D. of the base class will be called by an object of any class.
The member function of derived class is always accessed first in compare to base class.
A. aggregation.
B. indirect base class.
C. general base class.
D. double base class.
Aggregation is the feature in which a class contains objects of other class types as its member. It is also known as containership or containment.
A. direct base class.
B. indirect base class.
C. general base class.
D. double base class.
For a given class, all base classes that are not direct base classes are indirect base classes.
A. virtual.
B. friend.
C. abstract.
D. public.
We can specify that the compiler match a function call with the correct function definition at run time; this is called dynamic binding.
A. the function in the derived class gets higher priority, when the function is called as a member of the derived class object.
B. the function in the base class gets higher priority, when the function is called as a member of the derived class object.
C. the function in the derived class gets higher priority, when the function is called as a member of the base class object.
D. the function in the base class gets higher priority always.
The derived class is one, which derives the properties of base classes.
A. Creating a derived class from a base class requires fundamental changes to the base class.
B. In private inheritance, part of the base class interface can be made available to the functions outside the derived class.
C. The size of a derived class object is equal to the size of data members in the derived class only.
D. It is illegal to make objects of one class as members of another class.
When we inherit privately, all public members of the base class become private for the derived class. If we want only some of them to remain private and the rest to be accessible from outside the derived class, it can also be done.
A. public section of the base class.
B. private section of the base class.
C. protected section of the base class.
D. access modifier section of the base class.
To make private members of the base class inheritable, declare it under protected section of the base class.
A. single inheritance.
B. multiple inheritance.
C. multilevel inheritance.
D. hierarchical inheritance.
We can derive a class from any number of base classes in multiple inheritance. Here one derived class can inherit the properties from more than one base classes.
A. Inheritance and friendship are very similar
B. Virtual base classes remove ambiguity in inheritance
C. A nested class object can be declared within the outer class
D. In containership, only the object of another class is declared in a class
In C++, friendship is not inherited. If a base class has a friend function, then the function doesn't become a friend of the derived class(es).
A. the owl the pussycat
B. the pussycat the owl
C. the owl
D. the pussycat
Object of a contains object of b so, constructor of b is called before constructor of a.
A. the owl the pussycat
B. the owl
C. the pussycat the owl
D. error
At first constructor of a will be executed. After it the statement a::b ob will execute constructor of class b.
A. make hay while the sun is shining bright
B. its bright make hay while the sun is shining
C. the sun is shining make hay while its bright
D. its bright while the sun is shining
When an object of an derived class(c) is created, the program first calls the constructor for base class, then the constructor for the derived class.
A. make hay while the sun is shining
B. the sun is shining make hay while
C. make hay while
D. the sun is shining
When an object of a derived class is created, the program first calls the constructor for base class, then the constructor for the derived class.
A. cats and dogs it is raining
B. it is raining
C. it is raining cats and dogs
D. cats and dogs
When an object of a derived class is created, the program first calls the constructor for base class, then constructor for the derived class.
A. in i) X inherits Y in protected mode, ii) will give error
B. in i) X inherits Y in protected mode, ii) Z inherits Y in protected mode
C. in i) X inherits Y in protected mode, ii) Z inherits Y in private mode
D. in i) X inherits Y in protected mode, ii) Z inherits Y in public mode
The default access mode in C++ is private. Here in the statement - class Z : Y // Z is privately derived from Y.
A. public
B. protected
C. private
D. personal
Default visibility mode is private. Inheritable members of base become private members of subc.
A. error
B. in D
C. in B1 in B2 in D
D. in D in B2 in B1
The object calls its own class member named display( ).
A. in B1
B. in B2
C. in B1 in B2
D. error
Class D inherits two functions of the same name ,i.e., display(). Calling the function with class name is used to avoid ambiguity.
A. B( ) {}
B. B( int x, int y, int z) : A(int x, int y){}
C. B( int x, int y, int z) : A(x,y){}
D. B( int a, int b) : A(a, b){}
Constructors and destructors of base class are not inherited by the derived class. Rather, whenever, the derived class nedds to invoke base class's constructor or destructor, it can invoke them through explicitly calling them.
A. public members of class Animal
B. protected members of class Animal
C. public members of class Dog
D. private members of class Dog
With privately derived class, the public and protected members of the base class become private members of the derived class.
A. Base1′s constructor called
Base2′s constructor called
Derived’s constructor called
B. Compiler dependent
C. Base2′s constructor called
Base1′s constructor called
Derived’s constructor called
D. Compiler error
When a class inherits from multiple classes, constructors of base classes are called in the same order as they are specified in the inheritance.
Output:
A. Derived class
B. Abstract class
C. Virtual base class
D. Base class
When two or more objects are derived from a common base class, we can prevent multiple copies of the base class being present in an object derived from those objects by declaring the base class as virtual when it is being inherited. Such a base class is known as virtual base class.
A. 20, 4, 0
B. 22,4,10
C. 24,8, 40
D. 24, 8, 52
An int variable occupied 2 bytes whereas a float occupied 1 bytes.
A. Alpha (int i, float j, char k)
{ a=i; b = j; c=k;}
B. Alpha (i, j, k)
{ a=i; b = j; c=k;}
C. Alpha {int i, float j, char k}
( a=i; b = j; c=k;)
D. Alpha {int i, float j, char k}
( a=i, b = j, c=k)
class Alpha{
int a;
float b;
char c;
public:
Alpha (int i, float j, char k)
{ a=i; b = j; c=k;}
};
class Beta : public Alpha {
public:
Beta (int p, float q, char r) : Alpha (p,q,r)
{cout << "Beta constructor...";}
};
A. Outlet
B. Branch
C. Association
D. MNC
MNC class constructor can be called first at the time of declaration of an object of class Outlet. (When an object of the derived class is declared, in order to create it, firstly the constructor of the base class is invoked and then the constructor of the derived class is invoked. On the other hand, when an object of the derived class is destroyed, first the destructor of the derived class is invoked followed by the destructor of the base class.)
A. Enter(), Add() and DisplayData
B. Enter(), Output(), Add(), Show(), EnterData() and DisplayData
C. Output(), Show(), EnterData() and DisplayData
D. EnterData() and DisplayData
Outlet::Enter( ) Outlet::Output( ) MNC::EnterData( ) MNC::DisplayData( ) Branch::Add( ) Branch::Show( )
A. 41
B. 42
C. 31
D. 56
41 bytes
The memory will be reserved as follows:
char Dcode[5]; //5 Bytes
float Price; //4 Bytes
char EDName[20]; //20 Bytes
char BatteryType[10]; //10 Bytes
int Batteries; //2 Bytes
Total = 41 Bytes
A. Hybrid inheritance
B. Multiple inheritance
C. Hierarchical inheritance
D. Multilevel inheritance
In the given code, hierarchical inheritance has been used because the subclasses are derived from a single base class, which is Dolls.
A. A::A(), B::B(), C::C(), A::~A(), B::~B(), C::~C()
B. C::C(), B::B(), A::A(), C::~C(), B::~B(), A::~A()
C. C::C(), B::B(), A::A(), A::~A(), B::~B(), C::~C()
D. A::A(), B::B(), C::C(), C::~C(), B::~B(), A::~A()
When an object of a derived class is created, the program first calls the constructor for base class, then the constructor for the derived class. Similarly, when an object expires, the program calls the derived destructor, if any, and then the base destructor.
A. is an example of inheritance
B. cannot have objects outside
C. is a class defined within another class
D. can be declared only under private
One class may have another class defined within it known as nested class.
A. No objects are declared for the abstract class
B. The derived class constructor initializes its own, and base class data members
C. Nested class members can be called by the objects of the containing class
D. The derived class can use only some of the inherited members like its own members
Object cannot be created for abstract class. It is just the blueprint of the superclass.
A. CalcPrice and DInput
B. EDInput( ), EDShow( ), DInput( ) and DShow( )
C. SDInput( ), SDShow( ), DInput( ) and DShow( )
D. EDInput( ), EDShow( )
ElectronicDolls::EDInput( ), ElectronicDolls::EDShow( ), Dolls::DInput( ), Dolls::DShow( )
A. Polymorphism
B. Abstract classes
C. Overloading
D. Inheritance
Reusability of classes can be implemented through inheritance. Reusability means adding additional features to an existing class without modifying it. This is achieved by deriving a new class from the existing one. The new class will have combined features of both the classes.
A. first the derived class constructor is called then the base class constructor
B. first the base class constructor is called then the derived class constructor
C. only the base class constructor is called as it is not inherited
D. the copy constructor is called to create it
When an object of a derived class is created, the program first calls the constructor for base class, then the constructor for the derived class.
A. member are to be inaccessible from outside
B. member are to be inheritable but inaccessible from outside
C. member are to be inherited further
D. members are not to be inherited
With protected derived class, the public and protected members of the base class become protected members of the derived class. Thatmeans the inherited members are now not available to the outside world and can be accessed only through the member functions of the derived class and the classes based upon the derived class.
A. private, public and protected members become protected in the derived class
B. private, public and protected members become private, public and protected respectively in the derived class
C. public and protected members become protected in the derived class
D. public and protected members become public and protected respectively in the derived class
The protected derivation means that the derived class can access the public and private members of the base class protectedly.
A. multiple inheritance.
B. multilevel inheritance.
C. hierarchical inheritance.
D. single inheritance.
Multiple inheritance is when a subclass inherits from multiple base classes.
A. salary.
B. sport.
C. athlete.
D. team.
An abstract class is a class, which cannot be instantiated. It does not have instances.
A. two instances.
B. any instance.
C. multiple instance.
D. zero and multiple instance.
An abstract class is a class, which cannot be instantiated. It has no instances. Abstract classes are the classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation.
A. destructor.
B. constructor.
C. malloc().
D. calloc().
The destructors are used to deallocate memory, that was allocated for the object by the constructor.
A. is 0 byte.
B. is 1 byte.
C. is 2 byte.
D. can not be determined.
An empty class has size 1 byte. It cannot have 0 byte size.
A. are same as that of that derived class.
B. cannot be inherited by derived class.
C. can be inherited by derived class.
D. cannot be invoked by derived class by explicitly calling them.
Derived classes cannot inherit but, invoke the constructor or destructor of a base class by explicitly calling them.
A. derived class destructor followed by base class destructor.
B. base class destructor followed by derived class destructor .
C. only base class destructor.
D. only derived class destructor .