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

Answer Posted / ahsanullah

becouse of virtual keyword it will create only one instances,
so ANS is: 1

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c++ array?

554


Which coding certification is best?

571


What is null pointer and void pointer and what is their use?

589


What is a constant reference?

622


Define a conversion constructor?

619






What is the C-style character string?

605


What are references in c++?

662


Explain about vectors in c ++?

596


When should you use global variables?

630


What is capacity in vector in c++?

550


Write a note about the virtual member function?

605


Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work

606


What is difference between n and endl in c++?

584


Why do we use vector in c++?

602


Write about the use of the virtual destructor?

609