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 / boriska

CORRECTION to my previous post : please strike out "unless
you define similar create/destroy methods for class Derived
within Base class scope". Does not change the major idea,
just implications - but not well thought over.

The correct way is to declare class Derived as a friend to
class Base - like :
class Base
{
friend class Derived;
...
}

then Derived will be able to access Base's private
destructor. But you don't want to let that happen - as I
said - if you want to prohibit any further derivation. But
if you want to make an exception for some predefined types
derived from Base, that is the way.
Cheers and apologies.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is python written in c or c++?

1166


What things would you remember while making an interface?

1016


State the difference between delete and delete[].

1120


Difference between pass by value and pass by reference?

1164


What is ctime c++?

1134


What are exceptions c++?

1052


What is the use of register keyword with the variables?

947


How do you show the declaration of a virtual constructor?

949


What is the use of turbo c++?

1066


What is math h in c++?

1188


How can you link a c++ program to c functions?

1113


Is c++ an integer?

1049


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

1007


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3662


What is meant by iomanip in c++?

1231