???C++??Java?е????????????????????
???????????? ???????[ 2014/11/25 13:05:00 ] ????????Java C++ ????????
??????C++??
????1.??????????
????C++?е???????????????? ????????? ?????б????? ????????????????????????????в????б?????????????????????????????????????????????????????磺void display()??void display(int i);void dispaly(double i);void display(int i??double i);
????void display(double i??int i);????????????????????????з?????????????????????????????磺int display();??void display();?????????????
????????C++????????????????????????????У??????????????????????????????????
????2.??????????
????C++?е?????????????????????????????????????????????????????????????????????????????????????????????????????б???????????????????????????????????????????????::
1 #include<iostream>
2 using namespace std;
3 class person
4 {
5 ????public :
6 ????void display(int i){cout<<"????????"<<endl;}
7 ????//int display(int i){return 0;}
8 };
9 class student:public person
10 {
11 public :void display(){cout<<"??????????"<<endl;}
12 };
13 int main()
14 {
15 student *stu=new student();
16 //stu->display(0);//????C++?к????????????????????????????????????
17 //stu->person::display(0);//????????д
18 stu->display();//??? ??????????
/* person *per=new student();
per->display();//???????????//?????????????????
*/
19 return 0;
20 }
????3.?????????
????C++?к???????????????
??????1?????????????????麯??
??????2????????????????????λ??????????????
??????3??????????????б??????????
#include<iostream>
using namespace std;
class person
{
public :
virtual void display(){cout<<"????????????"<<endl;};
};
class student:public person
{
public :
void display(){cout<<"??????????????"<<endl;}
};
int main()
{
person *per=new person();
per->display();//???????????
delete per;
per=new student();
per->display();//?????????????????//?????????????????????
return 0;
}
??????
???·???
??????????????????
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