You are on page 1of 1

#include<iostream.

h>

#include<conio.h>

struct str1

{ private:

int x;

public:

int y;

protected:

int z;

};

struct str2:public str1

{ private:

int a;

public:

int b;

protected:

int c;

};

void main()

{ str2 abc;

abc.y=10;

// abc.z=11; //invalid protected members used by only public member fuctions

cout<<" "<<abc.y;

You might also like