Tij SWOT

xiaoxiao2021-03-06  55

1.4 Reusing the importation

We Could Reuse a class by Instantiate IT AS An Obect OR Place An Object of this Class Inside A New Class (this IS Called Composition ORGREGATION).

1.5 inheritance: Reusing the interface

Inheritance Enables Us Clone An Existing Class and Make Additions and Modifications To The Clone.The Modified "Clone" Will Reflects The CHANGE IN THE ORIGINAL CLESS?

Inheritance represents a certain kind of relationship between classes / types using the concept of base types and derived types. A base type contains all of the characteristics and behaviors that are shared among the types derived from it.

BY inheritance

1.5.1 IS-a vs. Is-Like-a RelationShip

If inheritance override only base-class function, this is a pure substitude.like "a circle is a shape".

WHEN WE Add New Interface Elements to a Derived Type, This Substitution isn't Perfect.this Can Be Described as an is-like-a rellationshipe. Such as "Heap Pump is like a cooling system".

1.6 Interchangeable Objects with Polymorphism

BY INHERITANCE, WE CREATE A LOT MORE New Objects, Which Has Similarities As The Base Objects. But is what all?

Let me think ... We got too many methods or functions have the same name or identification as a result of inheritance. Polymorphism is the mechanism of OOP to pick up the right one automatically. But we dont need to know how it does this at This Stage.

In a non-OOP compiler, the function call generated is early binding, that means the absolute address is needed. In OOP, the program can not determine the affress of the code until run-time. This concept is called late binging. To perform this Java Uses a Special Bit of Code in Lieu of The Absolute Call. This Code Calculates The Address of The Function Body, Using Information Stored In The Object.tis IS Java's Dynamic Binding.upcast ..

1.6.2 Abstract Base Classes and interfaces

To Declare AN Class Abstract, We Prevent Creating An Object of That Class.

WE CAN DECLARE A Class OR A Method As Abstract, But Abstract Method Can Only Be CREATED INSIDE ABSTRACT CLASS.

To Take The Concept of Abstract Class One Step Further, We Could Declare a class as an interface. Any Implementation of Methods IS STRICTLY Forbidden In an Interface.

转载请注明原文地址:https://www.9cbs.com/read-116526.html

New Post(0)