C++ Interview Question and Answers
56. |
What is the difference between class and structure? |
|
- By default, the members ot structures are public while that tor class is private.
- structures doesn’t provide something like data hiding which is provided by the classes.
- structures contains only data while class bind both data and member functions.
|
|
|
57. |
What are storage qualifiers in C++ ? |
|
ConstKeyword indicates that memory once initialized, should not be altered by a program. Volatile keyword indicates that the value in the memory location can be altered even though nothing in the program. Mutable keyword indicates that particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant. |
|
|
58. |
What is virtual class and friend class? |
|
Friend classes are used when two or more classes and virtual base class aids in multiple inheritance. Virtual class is used for run time polymorphism when object is linked to procedure call at run time. |
|
|
59. |
What is an abstract base class? |
|
An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function. |
|
|
60. |
What is dynamic binding? |
|
Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance. |
|
|