#include "stdafx.h"
#include<iostream>
using namespace std;
class A
{
public:
A(){}
void setdata(int s) {t=s;}
int getdata(){return t;}
protected:
int t;
};
class B: public A
{
public:
B(){}
};
void main()
{
A a;
a.setdata(3);
B b;
cout<<b.getdata();
}
Why I cannot get an output of 3 here? Can anyone help?
Thanks