Q.Which method in the code below is single level inherited? class A { protected int a, b; public: void show() { cout<<a<<b; } }; class B: public A { public: void disp() { cout<<a++<<b++; } }; class C: private A, public B { void avg() { cout<<(a+b)/2; } }; i Class A ii Class B iii Class C iv None
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Q.Which method in the code below is single level inherited?
class A
{
protected int a, b;
public: void show()
{
cout<<a<<b;
}
};
class B: public A
{
public: void disp()
{
cout<<a++<<b++;
}
};
class C: private A, public B
{
void avg()
{
cout<<(a+b)/2;
}
};
i Class A
ii Class B
iii Class C
iv None
Step by step
Solved in 2 steps