C++?????????д????????????????????
???????????? ???????[ 2017/2/8 11:16:23 ] ????????C++ ??????????? ????
?????????????????C++?????????д??????????????????????C++?????????????????????????????????????£?
????1.???????????overload????????????????????????????????????в???????У???????????????????????????????????????????б??????????????????????????????????????
??????????????£?
????class A{
????public:
????void test(int i);
????void test(double i);
????void test(int i?? double j);
????void test(double i?? int j);
????int test(int i); //??????????
????};
????????????????????????????????????????????
????2.??д????д??????override???????????????????????????????д?????????????????亯???????????б???????????????ж???????????б???д???????????к????岻??????????????????????????????????????д????????????????д????????д??????б???д???????????virtual???Ρ?
??????????????£?
????#include<iostream>
????using namespace std;
????class A{
????public:
????virtual void fun3(int i){
????cout << "A::fun3() : " << i << endl;
????}
????};
????class B : public A{
????public:
????//??д
????virtual void fun3(double i){
????cout << "B::fun3() : " << i << endl;
????}
????};
????int main(){
????A a;
????B b;
????A * pa = &a;
????pa->fun3(3);
????pa = &b;
????pa->fun3(5);
????system("pause");
????return 0;
????}
??????????麯???????????????????????麯?????????????
????3?????
???????????д??????
??????1????Χ??????д?????д??????????????У??????????????????????С?
??????2????????????д????д??????????б????????????????????????????б?????????
??????3??virtual????????д???????????virtual???Σ???????????????????????virtual???Σ????????С?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11