1 / 7
文档名称:

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

格式:txt   页数:7页
下载后只包含 1 个 TXT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

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

上传人:管理资源吧 2011/9/11 文件大小:0 KB

下载得到文件列表

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

文档介绍

文档介绍:×÷Õߣº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.