What is the difference between an uppercase "constructor" in javascript-js and a "constructor" starting with a double underline in a class?

Source: Internet
Author: User
In js, the function is capitalized as follows: {code ...} it can be called "Constructor". In a class, for example, (php) {code ...} __construct () is also called "constructor". What is the difference between the two types of construct () and construct? In js, the upper-case function is as follows:

Function Person (){//};

It can be called "Constructor ",
In a class, for example: (php)

Class Man extends Person {public function _ construct (){//}}

_ Construct ()Also called "Constructor ",
What are the differences between the two types of Constructors?

Reply content:

In js, the upper-case function is as follows:

Function Person (){//};

It can be called "Constructor ",
In a class, for example: (php)

Class Man extends Person {public function _ construct (){//}}

_ Construct ()Also called "Constructor ",
What are the differences between the two types of Constructors?

Syntax. php also supports class name functions as constructor methods, which are introduced by php5.3 with double underscores.

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.