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
What is static in c++?
What is the use of vtable?
What are c++ manipulators?
What do you mean by function and operator overloading in c++?
Is empty stack c++?
What are member functions used in c++?
What is the hardest coding language to learn?
What is a virtual destructor? Explain the use of it?
What is fflush c++?
Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?
What is a c++ vector?
Is c++ a pure oop language?
What is the function to call to turn an ascii string into a long?
Explain one-definition rule (odr).
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random