I am new in C++ and stuck with this problem. In below code, which statement
cout<<obj.a<<endl;
cout<<obj.b<<endl;
cout<<obj.c<<endl;
cout<<obj.c+obj.a+obj.b<<endl;
prints the output without error?. I am stuck with object creation also. If I create obj as A obj , it also showing error.
#include <iostream>
using namespace std;
main(){
class A
{
    protected:
    int a;
    private:
    float b;
    public:
    double c;
    A(int x,float y,double z)
    {
        a=x;
        b=y;
        c=z;
    }
};
class B: public A
{
    public:
    B(int x,float y,double z): A(x,y,z)
    {
    }
};
class C: public B
{
    public:
    C(int x,float y,double z): B(x,y,z)
    {
    }
};
cout<<obj.a<<endl;
cout<<obj.b<<endl;
cout<<obj.c<<endl;
cout<<obj.c+obj.a+obj.b<<endl;
}
 
    