???C++??Java?е????????????????????
???????????? ???????[ 2014/11/25 13:05:00 ] ????????Java C++ ????????
??????Java??
????1.??????????
??????Java?к????????? ?????????????????????? ????????????????????????б????????????????????????????
1 class BaseClass
2 {
3 public static void display(int i){System.out.println("Baseclass");}
4 }
5 public class ThisClass extends BaseClass
6 {
7 public static void display(){System.out.println("ThisClass");}
8 public static void main(String[]args)
9 {
10 display();//??????????????
11 display(0);//???????????
////////////////////////////////////////////////////////////
???????з???????????? ??C++???
12 }
13 }
?????????л???BaseClass ?е?void display(int i);????????ThisClass?е?void display();??????????
????2.?????????
????Java?к??????????????????????? ?????????????б???????????????£?
1 public class PrivateOverride
2 {
3 public void f(){System.out.println("private f()");}
4 //private void f(){System.out.println("private f()");}
5 public static void main(String[]args)
6 {
7 PrivateOverride po=new Derived();
8 po.f();//???public f()//?????????????????????????
9 }
10
11 }
12 class Derived extends PrivateOverride
13 {
14 public void f(){System.out.print("public f()");}
15 }
????3.?????? ?????????? f()????????????private??????? private f() ?ó??????????з?private??????????????
??????
???·???
??????????????????
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