-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut39.cpp
More file actions
28 lines (24 loc) · 706 Bytes
/
tut39.cpp
File metadata and controls
28 lines (24 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
For a protected member:
public derivation private derivation protected derivation
1.private members not inherited not inherited not inherited
2.Public members public private protected
3.Protected members protected private protected
*/\
#include<bits/stdc++.h>
using namespace std;
class base{
protected:
int a;
private:
int b;
};
class derived: protected base{
};
int main(){
base c;
derived d;
//cout<<d.a;//can't be accessed as its protected
//cout<<c.a;//can't be accessed as its protected
return 0;
}