+91-6376366224     Send message / ask question on our official What's App Number .

Set - 2

Question 1 :

Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?

Answer :

Yes.


Question 2 :

What are the advantages of inheritance?

Answer :

• It permits code reusability.
• Reusability saves time in program development.
• It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.


Question 3 :

What is the difference between declaration and definition?

Answer :

The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.:

void stars () //function declaration

The definition contains the actual implementation.
E.g.:

void stars () // declarator

 


Question 4 :

Does c++ support multilevel and multiple inheritance?

Answer :

Yes.


Question 5 :

What is a template?

Answer :

Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro.

Its prototype is any of the two following ones:
template <class indetifier> function_declaration; template <typename indetifier> function_declaration;
The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expressions have exactly the same meaning and behave exactly the same way.