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 the difference between a copy constructor and an overloaded assignment operator?

4 Answers   Belzabar, Citrix, Microsoft, Wipro,


What are stacks?

0 Answers  


Does improper inheritance have a potential to wreck a project?

0 Answers  


Which should be more useful: the protected and public virtuals?

0 Answers  


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,


i have given a project to create examination seating plan system in c++. so can anyone send me the answer of this question quickly??????

1 Answers  


How are Structure passing and returning implemented by the compiler?

0 Answers  


What is the real purpose of class – to export data?

0 Answers  


Explain object slicing in c++?

0 Answers  


Is c# written in c++?

0 Answers  


What is an orthogonal base class in c++?

0 Answers  


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

0 Answers  


Categories