Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



class professor {}; class teacher : public virtual professor {}; class researcher : public virtu..

Answer / guest

Ans is value 1 i.e ans B

Is This Answer Correct ?    22 Yes 0 No

class professor {}; class teacher : public virtual professor {}; class researcher : public virtu..

Answer / ahsanullah

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

Is This Answer Correct ?    6 Yes 0 No

class professor {}; class teacher : public virtual professor {}; class researcher : public virtu..

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

class professor {}; class teacher : public virtual professor {}; class researcher : public virtu..

Answer / alliance group

answer is 1......b option

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is singleton class in c++?

0 Answers  


How to detect memory leaks in c++

1 Answers   Mphasis,


What are the benefits of c++?

0 Answers  


What is fixed in c++?

0 Answers  


Why for local variables the memory required to hold the variable is allocated from the program stack and for new its allocated from the heap?

1 Answers  


What is the difference between global int and static int declaration?

0 Answers  


class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.

2 Answers   Quark,


Differentiate between a constructor and a method in C++.

0 Answers   Tech Mahindra,


what is the behaviour of C and C++ compiler for the below statements. int *p; p = malloc(100); Is the behaviour same ? or different ?

2 Answers  


Is std :: string immutable?

0 Answers  


Describe exception handling concept with an example?

0 Answers  


What is math h in c++?

0 Answers  


Categories