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
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
Describe the syntax of single inheritance in C++?
What is stoi in c++?
what Is DCS ? what i will get benefit when i did?
What are arrays c++?
What is c++ & why it is used?
Is string an object in c++?
What are the differences between java and c++?
Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort
What do c++ programmers do?
Does c++ have a hash table?
What is ifstream c++?
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
How long it will take to learn c++?
What is the difference between passing by reference and passing a reference?