forked from Light-City/CPlusPlusThings
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusing_derived.cpp
More file actions
Latest commit
36 lines (32 loc) · 527 Bytes
/
Copy pathusing_derived.cpp
File metadata and controls
36 lines (32 loc) · 527 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
/**
* @file using_derived.cpp
* @brief 函数重装
* @author 光城
* @version v1
* @date 2019-08-07
*/
#include<iostream>
usingnamespacestd;
classBase{
public:
voidf(){ cout<<"f()"<<endl;
}
voidf(int n){
cout<<"Base::f(int)"<<endl;
}
};
classDerived : privateBase {
public:
using Base::f;
voidf(int n){
cout<<"Derived::f(int)"<<endl;
}
};
intmain()
{
Base b;
Derived d;
d.f();
d.f(1);
return0;
}