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
Is java as fast as c++?
Explain the use of vtable.
What is type of 'this' pointer? Explain when it is get created?
Write a program which uses functions like strcmp(), strcpy()? etc
Does c++ have foreach?
Is it possible to write a c++ template to check for a function's existence?
What is the disadvantage of using a macro?
What is the purpose of extern storage specifier?
What does count ++ do in c++?
How do you establish a has-a relationship?
What is different in C++, compare with unix?
Is eclipse good for c++?
What are the uses of static class data?
What is this weird colon-member (" : ") syntax in the constructor?
Describe private, protected and public – the differences and give examples.