forked from rahulgoyal911/cPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritence.cpp
More file actions
42 lines (42 loc) · 741 Bytes
/
inheritence.cpp
File metadata and controls
42 lines (42 loc) · 741 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
30
31
32
33
34
35
36
37
38
39
40
41
42
//base private protetcted public:
//private: Not inherited Not inherited Not inherited
//public: private protected public
//protected: private protected protected
using namespace std;
#include<iostream>
class base
{
int a,b;
public:
void get()
{
cin>>a>>b;
}
protected:
void print()
{
cout<<a<<b;
}
};
class deriverd:visibilitymode base
{
int c;
public:
void get()
{
cin>>c;
}
protected:
void print()
{
cout<<c;
}
};
int main()
{
base ob;
derived ob1;
ob.get();
ob1.get()
return 0;
}