-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathobject.lyx
More file actions
9029 lines (6086 loc) · 162 KB
/
Copy pathobject.lyx
File metadata and controls
9029 lines (6086 loc) · 162 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass ctex-book
\begin_preamble
\input{../../writing-common/book-preamble.tex}
\end_preamble
\use_default_options true
\begin_modules
theorems-bytype
theorems-chap-bytype
coderemarks
note-inset
tip-inset
warning-inset
logicalmkup
\end_modules
\maintain_unincluded_children false
\begin_local_layout
PackageOptions url hyphens
\end_local_layout
\language chinese-simplified
\language_package default
\inputencoding utf8-plain
\fontencoding global
\font_roman "default" "DejaVu Sans"
\font_sans "default" "DejaVu Serif"
\font_typewriter "default" "DejaVu Sans Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures false
\graphics default
\default_output_format pdf4
\output_sync 0
\bibtex_command default
\index_command default
\float_placement tbph
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 3
\pdf_breaklinks true
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\boxbgcolor #d8daeb
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 2
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Chapter
面向对象编程基础
\begin_inset CommandInset label
LatexCommand label
name "chap:面向对象的基本概念"
\end_inset
\end_layout
\begin_layout Standard
\align center
\begin_inset Graphics
filename imgs/oopbasic/oop.png
width 100col%
\end_inset
\end_layout
\begin_layout Section
再说C语言的struct
\end_layout
\begin_layout Standard
C语言以简练、灵活、高效著称,但是C语言本身提供的基本数据类型有限,描述现实世界的能力自然也有限。比如要求输入班级同学的英语和数学成绩并按照平均成绩排序
\begin_inset Note Note
status open
\begin_layout Plain Layout
这个例子不恰当,排序任务脱离了对象本身,是否换成画图 or animal,涉及到各种图形和图形的操作?
\end_layout
\end_inset
,如果我们仅使用C的基本数据类型来设计的话,大概能想到的策略有如下几种:
\end_layout
\begin_layout Enumerate
每个同学都用三个变量来表示:zhangsan_name, zhangsan_english, zhangsan_math, wangwu_name,
wangwu_english, wangwu_english......。如果班级有40位同学,这需要120个变量来表达,不仅容易写错,还不胜其烦!这个思路显然值得商榷,
为下策。
\end_layout
\begin_layout Enumerate
使用数组来分别存储同学的名字、英语成绩和数学成绩,比如下面的代码片段:
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
char* name[40];
\end_layout
\begin_layout Plain Layout
float english_score[40];
\end_layout
\begin_layout Plain Layout
float math_score[40];
\end_layout
\end_inset
使用数组极大减少了变量的数量,但是也存在一个问题,我们其实隐含了这样一条规则:name数组的第i个元素(同学)的英语成绩是english_score数组的第i个
元素,数学成绩是math_score数组的第i个元素。也就是说,这三个数组的对应元素有一一映射的关系。这个一一映射的关系是需要我们程序员自己维护的,也就是说,如
果我们破坏了这一隐含的规则,无论有意还是无意,编译器并不能帮助我们发现这个“破坏”,因为从语法上,不符合这个隐含规则也是允许的,这即为程序员带来了负担,也为程序
埋下了隐患。可以看出,带来这些问题的关键原因是三个数组的一一映射关系不是
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
语法级别的映射
\end_layout
\end_inset
,编译器无法
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
从语法上保证和检查
\end_layout
\end_inset
这三个数组是否遵循了一一映射的关系,这就是C语言引入struct概念的原因:将变量之间的映射关系语法化,我们看使用struct如何解决这个问题。
\end_layout
\begin_layout Enumerate
使用
\begin_inset Index idx
status open
\begin_layout Plain Layout
struct
\end_layout
\end_inset
struct描述同学们的英语和数学成绩,代码片段如下:
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
struct score{
\end_layout
\begin_layout Plain Layout
char* name;
\end_layout
\begin_layout Plain Layout
float english_score;
\end_layout
\begin_layout Plain Layout
float math_score;
\end_layout
\begin_layout Plain Layout
float avg_score;/*平均成绩*/
\end_layout
\begin_layout Plain Layout
};
\end_layout
\begin_layout Plain Layout
struct score stu_scores[40];
\end_layout
\end_inset
struct在语法上保证了name、english_score、math_score这三个变量是一一映射的,是score结构体的“成员分量
\begin_inset Index idx
status open
\begin_layout Plain Layout
成员分量
\end_layout
\end_inset
”,因此struct在语法上保证了名字和成绩不可能张冠李戴,杜绝了可能存在的隐患,也减轻了程序员的思想负担(不需要时刻提醒自己要维护姓名和成绩的映射关系)。所以
,struct是C语言的重要组成部分,是C语言描述现实世界的重武器,在大型项目中大量使用struct来表达同类事物的共同特征(属性)。比如打开Linux内核源代
码的头文件目录,我们随处可见大量的struct定义:
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
struct font_desc {
\end_layout
\begin_layout Plain Layout
int idx;
\end_layout
\begin_layout Plain Layout
const char *name;
\end_layout
\begin_layout Plain Layout
int width, height;
\end_layout
\begin_layout Plain Layout
const void *data;
\end_layout
\begin_layout Plain Layout
int pref;
\end_layout
\begin_layout Plain Layout
};
\end_layout
\end_inset
因此,我们可以这样定义struct:
\end_layout
\begin_layout Definition
\begin_inset Index idx
status open
\begin_layout Plain Layout
struct
\end_layout
\end_inset
struct是对一类事物公共属性的描述。
\end_layout
\begin_layout Subsection
struct的局限性
\begin_inset CommandInset label
LatexCommand label
name "subsec:struct的局限性"
\end_inset
\end_layout
\begin_layout Standard
C语言通过struct大大扩充了C的数据类型,每一个struct都定义了一种新的数据类型来对应客观世界的某种事物,这样C语言不但描述客观世界的能力大大加强了,C
语言程序的可读性、可维护性也大大提高了。
\end_layout
\begin_layout Standard
C语言能够更好的描述客观世界,可以给struct记大功一件。但是,我们描述客观世界的目的是认识世界并进而改造世界,struct仅仅是方便了描述世界,对于改造世界
并没有多大帮助。比如回到我们本章开头的问题:我们不仅仅要输入同学们的成绩,还要按照平均成绩排序。这里至少包含两个方面的“认识世界”和“改造世界”世界的动作:
\end_layout
\begin_layout Enumerate
计算平均成绩:这是属于进一步认识世界的范畴:根据已有的事物属性,我们可以计算和推断出新的属性。
\end_layout
\begin_layout Enumerate
按照平均成绩排序:这是属于改造世界的范畴:对已有事物重新组合排序。
\end_layout
\begin_layout Standard
struct帮助我们很好的描述了同学们的名字和成绩的对应关系,但是计算平均成绩和按照成绩排序这两个“动作”,在C语言中是通过独立的函数来实现的,比如下面的代码片
段:
\end_layout
\begin_layout Standard
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
void calculate_avg_score(struct score* score) {
\end_layout
\begin_layout Plain Layout
/*按照某种权重算法计算平均成绩并保存到score.avg_score中*/
\end_layout
\begin_layout Plain Layout
}
\end_layout
\begin_layout Plain Layout
struct score[] sort_score(struct score* scores[]) {
\end_layout
\begin_layout Plain Layout
/* 将数组scores排序后返回新的struct score数组*/
\end_layout
\begin_layout Plain Layout
}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
可以看出,calculate_avg_score函数和sort_score函数虽然都和struct score有关系(作为参数或者返回值),但是这种关系是“弱关
系”,因为calcuate_avg_score、sort_score可以没有定义,可以存在于另外的文件中,可以被定义为另外的名称等等。也就是说,在语法上,str
uct score和这两个函数并没有必然的联系,编译器没有办法帮助程序员检查这两个函数和struct score的映射关系,一切还需要程序员人工的
\begin_inset Quotes erd
\end_inset
细心
\begin_inset Quotes erd
\end_inset
照料。显然,struct一定程度上解决了描述世界的问题,但是没有解决认识世界和改造世界的问题。
\end_layout
\begin_layout Section
类和对象的初步概念
\end_layout
\begin_layout Subsection
类是struct概念的自然延伸
\end_layout
\begin_layout Standard
C中的struct实现了对客观事物属性的分组描述,即同一类型的客观事物的属性可以用一个struct来表达。正如
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
sectionname
\end_layout
\end_inset
\begin_inset CommandInset ref
LatexCommand vref
reference "subsec:struct的局限性"
\end_inset
所述,struct有其局限性,只能描述客观事物的属性,不能表达对客观事物的进一步认知动作和改造利用的动作,于是在面向对象的程序设计语言中引入“
\begin_inset Index idx
status open
\begin_layout Plain Layout
类
\end_layout
\end_inset
类”的概念弥补struct的这一缺陷。
\end_layout
\begin_layout Definition
类是对一类客观事物公共
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
属性
\end_layout
\end_inset
和
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
动作
\end_layout
\end_inset
的描述。
\end_layout
\begin_layout Standard
对比struct我们可以看出,类比struct多了“动作”的描述,也就是说,类即可以描述事物的属性,也可以描述我们可以对(用)这类事物“做什么”,是对客观世界的
完整的描述。Java使用
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
class
\end_layout
\end_inset
关键字来定义类,一个简单的只包含属性的类和struct非常相似,比如二维坐标中的“点”,一开始可以这样定义(右边作为对照,列出了C中point结构体的定义):
\end_layout
\begin_layout Standard
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "40line%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open
\begin_layout Plain Layout
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
Java的Point类定义
\end_layout
\end_inset
\end_layout
\begin_layout Plain Layout
class Point {
\end_layout
\begin_layout Plain Layout
int x; // 点的x坐标
\end_layout
\begin_layout Plain Layout
int y; // 点的y坐标
\end_layout
\begin_layout Plain Layout
}
\end_layout
\end_inset
\end_layout
\end_inset
\begin_inset space \hfill{}
\end_inset
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "45line%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open
\begin_layout Plain Layout
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
C的point结构体定义
\end_layout
\end_inset
\end_layout
\begin_layout Plain Layout
struct point {
\end_layout
\begin_layout Plain Layout
int x; /*点的x坐标*/
\end_layout
\begin_layout Plain Layout
int y; /*点的y坐标*/
\end_layout
\begin_layout Plain Layout
};
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
但是如果只是使用class替换了struct关键字,显然没有发挥类描述客观事物的最大威力,因此一个更合理的Point类如
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
lstlistingname
\end_layout
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "Point.java"
\end_inset
所示。
\end_layout
\begin_layout Standard
\begin_inset CommandInset include
LatexCommand lstinputlisting
filename "code/oopbasic/src/cn/edu/sdut/softlab/oopbasic/sub321/Point.java"
lstparams "caption={Point.java},label={Point.java}"
\end_inset
\end_layout
\begin_layout Standard
可以看出,在这个版本的Point类定义中,“点”的属性(x,y)和对点的操作moveTo封装在一起了。
\end_layout
\begin_layout Subsection*
定义Java类
\begin_inset CommandInset label
LatexCommand label
name "subsec:定义Java类"
\end_inset
\begin_inset Note Note
status open
\begin_layout Plain Layout
为了满足李震梅老师的审美观,修改为star form section
\end_layout
\end_inset
\end_layout
\begin_layout Standard
完整的定义Java类的语法是:
\end_layout
\begin_layout Standard
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
[public] class ClassName { ...}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
这里有几个要点:
\end_layout
\begin_layout Itemize
大部分情况下需要将类定义为
\begin_inset Index idx
status open
\begin_layout Plain Layout
public
\end_layout
\end_inset
public的,参见
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
sectionname
\end_layout
\end_inset
\begin_inset CommandInset ref
LatexCommand vref
reference "subsec:类的访问控制"
\end_inset
。
\end_layout
\begin_layout Itemize
类名的常规命名遵循驼式命名法
\begin_inset Index idx
status open
\begin_layout Plain Layout
驼式命名法
\end_layout
\end_inset
,并且第一个字母是大写的。
\end_layout
\begin_layout Itemize
一个Java源代码文件中只能有一个类是public的,且这个public的类名必须和文件名完全一致,包括大小写。
\end_layout
\begin_layout Itemize
在Java源代码文件中可以定义多个类,只要保证只有一个public类即可。
\end_layout
\begin_layout Subsection
对象的概念
\begin_inset Note Note
status open
\begin_layout Plain Layout
画图说明更清晰
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Wrap figure
lines 0
placement r
overhang 0in
width "30line%"
status open
\begin_layout Plain Layout
\align center
\begin_inset Graphics
filename imgs/oopbasic/point-monitor.eps
lyxscale 20
width 100line%
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
类和实例的关系
\begin_inset CommandInset label
LatexCommand label
name "fig:类和实例的关系"
\end_inset
\end_layout
\end_inset
\end_layout
\end_inset
类是对一类事物的抽象描述,比如Point类是对二维坐标“点”的抽象描述,它表达了屏幕上的一个点所具有的公共属性:x坐标和y坐标,以及我们可以对“点”的操作,比如
moveTo操作。但是,Point类并没有和屏幕上的实体点绑在一起,屏幕上的每一个实体点,可以看作Point类的一个具体
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
\begin_inset Index idx
status open
\begin_layout Plain Layout
实例
\end_layout
\end_inset
实例
\end_layout
\end_inset
,都具有Point类给出的一些属性,在这里就是屏幕上的每一个实体点都有相应的x、y坐标。我们把实体点叫做类Point的
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
实例(instance)
\end_layout
\end_inset
,或者叫做类Point的
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
\begin_inset Index idx
status open
\begin_layout Plain Layout
对象
\end_layout
\end_inset
对象
\end_layout
\end_inset
。
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
对象就是实例,实例就是对象
\end_layout
\end_inset
。可以看出,一个类可以创建若干实例,所有实例(对象)都具有类中定义的属性,只是属性的值各不相同而已,一般称作对象的状态不同。比如,点(1,2),(3,5),(1
0,50)都是Point的实例。
\end_layout
\begin_layout Standard
在这里有必要进一步澄清一下常见的几种说法:
\end_layout
\begin_layout Itemize
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
类(class)
\end_layout
\end_inset
就是类型的意思,定义了一个类,就是定义了一个新的数据类型,表达某种事物的公共属性和方法,我们可以根据类创建多个实例(对象)。
\end_layout
\begin_layout Itemize
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
对象(object)即类的实例
\end_layout
\end_inset
。如果把类看作数据类型,则对象可以看作变量。
\end_layout
\begin_layout Itemize
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
对象的属性
\begin_inset Index idx
status open
\begin_layout Plain Layout
属性
\end_layout
\end_inset
(property)即为类的“成员分量”
\end_layout
\end_inset
(借用struct的叫法),即类中定义的变量。
\end_layout
\begin_layout Itemize
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
对象的方法
\begin_inset Index idx
status open
\begin_layout Plain Layout
方法
\end_layout
\end_inset
(method)即为类中定义的函数
\begin_inset Index idx
status open
\begin_layout Plain Layout
函数
\end_layout
\end_inset
\end_layout
\end_inset
。由于这些函数往往是操作类的属性的某种方法,因此大家习惯上称为对象的方法。
\end_layout
\begin_layout Standard
在java中,通过
\begin_inset Index idx
status open
\begin_layout Plain Layout
new
\end_layout
\end_inset
new操作符创建类的实例(对象),比如new Point()创建了一个“点”的实例(对象)。和C语言中访问struct的成员变量类似,访问Java对象的属性和方
法是通过
\begin_inset Flex Strong
status open
\begin_layout Plain Layout
.
\end_layout
\end_inset
运算符实现的
\begin_inset Foot
status open
\begin_layout Plain Layout
和C语言不同的是,由于Java中没有提供指针,在Java中不存在->运算符。
\end_layout
\end_inset