-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut38.cpp
More file actions
29 lines (22 loc) · 845 Bytes
/
tut38.cpp
File metadata and controls
29 lines (22 loc) · 845 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
29
#include<iostream>
using namespace std;
class base{
protected: // protected data can be inherit and private cant.
int a;
private:
int b;
};
class deriv: protected base{
};
/*modifiers when they are derived “public”, “private”, and “protected”.
Public Derivation Private Derivation Protected Derivation
Private members Not Inherited Not Inherited Not Inherited
Protected members Protected Private Protected
Public members Public Private Protected */
int main(){
base de;
deriv df;
// cout<<de.a;
// cout<<df.a; will not work becaouse its was protcetd in both the classes
return 0;
}