Overloading overriding runtime type and object orientation (1)(1).txt


文档分类:管理/人力资源 | 页数:约7页 举报非法文档有奖
1/7
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/7
文档列表 文档介绍
×÷Õߣºjeru
email: jeru@
ÈÕÆÚ£º7/3/2001 10:01:58 AM
6)Overloading overriding runtime type and object orientation
Objective 1)
State the benefits of encapsulation in object oriented design and write code that implements tightly encapsulated classes and the relationships "is a" and "has a".
Encapsulation involves hiding data of a class and allowing access only through a public interface.
The separation of interface and implementation makes it easier to modify the code within a class without breaking any other code that uses it.
encapsulation, inheritance, polymorphism are three principal characteristics of Object Oriented programming.
Implementing OO relationships
¡¤ ¡°is a¡± relationship is implemented by inheritance (extends keyword)
¡¤ ¡°has a¡± relationship is implemented by providing the class with member variables.
Overloading and Overriding
¡¤ Overloading is an example of polymorphism. (operational / parametric)
¡¤ Overriding is an example of runtime polymorphism (inclusive)
¡¤ A method can have the same name as another method in the same class, provided it forms either a valid overload or override
Objective 2)
Write code to invoke overridden or overloaded methods and parental or overloaded constructors; and describe the effect of invoking these methods.
Overloading Overriding
Signature has to be different. Just a difference in return type is not enough.

Overloading overriding runtime type and object orientation (1)(1) 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
最近更新