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
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Why do we use double in c++?
Why is main an int?
How does list r; differs from list r();?
How do you remove an element from a set in c++?
Is eclipse good for c++?
What is private inheritance?
How can you quickly find the number of elements stored in a static array?
Is facebook written in c++?
What will the line of code below print out and why?
Ask to write virtual base class code?
What does obj stand for?
Name four predefined macros.
what are the types of Member Functions?
How is c++ different from java?