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

Is java as fast as c++?

1110


Explain the use of vtable.

1097


What is type of 'this' pointer? Explain when it is get created?

1020


Write a program which uses functions like strcmp(), strcpy()? etc

1110


Does c++ have foreach?

1074


Is it possible to write a c++ template to check for a function's existence?

1037


What is the disadvantage of using a macro?

1131


What is the purpose of extern storage specifier?

1195


What does count ++ do in c++?

1214


How do you establish a has-a relationship?

1119


What is different in C++, compare with unix?

1105


Is eclipse good for c++?

1061


What are the uses of static class data?

1190


What is this weird colon-member (" : ") syntax in the constructor?

1033


Describe private, protected and public – the differences and give examples.

1203