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

class A;//forward decleration
class B
{
B();
public:
friend A;
}
class A:public virtual B
{
public:
A()
};
class C:public A
{
public:
C()
};

int main()
{
A a; // allowed
C c;//not allowed
return 0;
}

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of function pointer?

1031


What are the restrictions apply to constructors and destructors?

1083


How should a contructor handle a failure?

1195


How can we check whether the contents of two structure variables are same or not?

1074


What is the difference between structure and class?

1280


What is protected inheritance?

1049


What is a catch statement?

1052


Explain pass by value and pass by reference.

1061


What is jump statement in C++?

1139


Can we define a constructor as virtual in c++?

1129


Will rust take over c++?

1061


What do you mean by a template?

1070


What is ios flag in c++?

1215


Write about the use of the virtual destructor?

1009


Describe the process of creation and destruction of a derived class object?

1120