Inheritance in PHP

Source: Internet
Author: User

Inheritance Basic Concepts

put a class the attribute information in a is passed to another class B , and this is called:

B inherit A

A derives from B;

Basic Syntax:

several basic concepts

Inheritance: A class obtains its attributes from another existing class, called inheritance.

Derivation: Produces a new class from an existing class, called a derivation.

Parent class /Subclass: An existing class is a parent class, and a new class is a subclass. The parent class can also be called the "base class", the Ancestor class, the subclass is also called the derived class, the subordinate class,

Single inheritance: A class can inherit its attribute information only from a parent class. PHP and most object-oriented languages are single-inheritance modes . C + + is multiple inheritance.

Extensions: Define some of your own new and unique attribute information (properties, methods, and constants) in the subclass. Without an extension, inheritance is meaningless.

Inheritance in PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.