Home > Java > javaTutorial > body text

Inheritance of the three major features in java

高洛峰
Release: 2016-11-19 10:11:26
Original
1305 people have browsed it

Characteristics of inheritance: Inherit the attributes and methods of the parent class. Single inheritance (multi-level inheritance) Inheritance in C++ is multiple inheritance

                                                                                                         .                . For example: people can raise dogs; -Team ---- & gt; Player: Overall and part of the relationship. Code is the most common relationship of s Has A

&; Student: Student: Student: Explain that there is a inheritance relationship, whether the relationship is manifested, and there are specific situations to determine.

How to judge whether there is an inheritance relationship between two things: is a Who is who is established. There is an inheritance relationship when it is established.

A:B: How to write inheritance in OC

How to express inheritance relationship in java:

Use keyword: extends to express inheritance.字 Inheritance: Use keywords: EXTENDS

Structure:

Class A EXTENDS B: Class A inheritance B.

                                                                                                                                                               inheritance. 3. Family constructors cannot be inherited.

                    4. When a subclass calls its own constructor, it will call the parameterless constructor in the parent class by default.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!