class professor {};
class teacher : public virtual professor {};
class researcher : public virtual professor {};
class myprofessor : public teacher, public researcher {};
Referring to the sample code above, if an object of class
"myprofessor" were created, how many instances of professor
will it contain?
a) 0
b) 1
c) 2
d) 3
e) 4
Answers were Sorted based on User's Feedback
Answer / ahsanullah
becouse of virtual keyword it will create only one instances,
so ANS is: 1
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / d.sakthi
ans is 1 option b
reason:as three classes are derived from base class single instance is enough
Is This Answer Correct ? | 3 Yes | 0 No |
What is iomanip c++?
What are enumerations?
What is c++ library?
In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest.
Can you please explain the difference between using macro and inline functions?
What is a character in c++?
Is c++ slower than c?
Why did you leave your last job?
What is optimization in c++? when using volatile.optimization is not possible..what does this mean?
Is std :: string immutable?
What is nested class in c++?
What are default parameters? How are they evaluated in c++ function?