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 does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

0 Answers  


What are pointer-to-members in C++? Give their syntax.

0 Answers   HAL,


Define the process of handling in case of destructor failure?

0 Answers  


What do you mean by C++ access specifiers ?

1 Answers  


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


In a function declaration what does extern means?

0 Answers   Flextronics,


What is object oriented programming (oop)?

0 Answers  


How can you find the nodes with repetetive data in a linked list?

1 Answers   Lucent,


When to use “const” reference arguments in a function?

0 Answers  


What are different types of typecasting supported by C++

1 Answers   CA,


What is an incomplete type?

1 Answers  


Difference between delete and free.

0 Answers  


Categories