Which among the following can restrict class members to get inherited?
Private members of a class can’t be inherited. These members can only be accessible from members of their own class only.
When a destructor is called?
The destructor is called just before the object goes out of scope or just before its life ends. This is done to ensure that all the resources reserved for the object are used and at last, are made free for others.
Which problem may arise if we use abstract class functions for polymorphism?
The undefined functions must be defined is a problem, because one may need to implement a few undefined functions from an abstract class, but he will have to define each of the functions declared in an abstract class. Being a useless task is a problem sometimes.
While we can do using encapsulation?
Data member’s data type can be changed without changing any further code. All the members using that data can continue in the same way without any modification. Member functions can never change the data type of same class data members.
Hiding the implementation complexity can be useful for
Hiding the implementation can make programming easy. The programming need not know how the inbuilt functions are working but can use those complex functions directly in the program. It doesn’t provide more number of features or better features.
If the object is passed by value to a copy constructor?
The compiler runs out of memory. This is because while passing the argument by value, a constructor of the object will be called. That in turn called another object constructor for values, and this goes on. This is like a constructor call to itself, and this goes on infinite times, hence it must be passed by reference so that the constructor is not called.
Which among the following is not true for polymorphism?
It never increases function definition overhead, one way or another if you don’t use polymorphism, you will use the definition in some other way, so it actually helps to write efficient codes.
How can Encapsulation be achieved?
Using access specifiers we can achieve encapsulation. Using this we can in turn implement data abstraction.
Which among the following is true for copy constructor?
It can’t be defined with a zero number of arguments. This is because to copy one object to another, the object must be mentioned so that compiler can take values from that object.
Which among the following best describes destructor?
The Destructors are special functions that are called just before an object is destroyed. This function is responsible to free all the allocated resources to the object. Objects are destroyed whenever those go out of scope.