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...

How would you stop a class from class from being derived or
inherited?The constructer should not be Private,as object
instantiation should be allowed.

Answer Posted / vikas

Kamma's answer is right. Here is the explanation:

First a brush of some C++ concepts:

1. In virtual inheritance, the most derived class calls the
virtual base class' c'tor/d'tor.

2. The class declared as 'friend class' can access the
private member functions of a class.

In A a; A' compiler tries to call A::A(), since its declared
as public its called. Now A::A() requires to call its parent
class's c'tor which although private but is able to be
called[1 above].

In C c; C::C() calls B::B()[2 above].
C being a non friend class can't access B::B() which is private.

More at:
http://www.cppquestions.com/viewtopic.php?f=33&t=25

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does atoi function work?

1099


Explain the uses of static class data?

1052


What are inline functions? What is the syntax for defining an inline function?

1083


What is microsoft c++ redistributable?

1025


Can I learn c++ without learning c?

939


Briefly describe a B+ tree. What is bulk loading in it?

1251


What is an inline function in c++?

1066


Which coding certification is best?

968


What is oop in c++?

1029


How do I make turbo c++ full screen?

1024


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

1265


What is a class definition?

1007


When there is a global variable and local variable with the same name, how will you access the global variable?

1045


Explain pass by value and pass by reference.

1000


How do c++ struct differs from the c++ class?

1118