I have a question for Han Shunping 149-php Tutorial

Source: Internet
Author: User
I have a question for Han Shunping 149.
Class A {public function _ construct () {echo "A constructor" ;}} class B extends A {}$ B = new B () ;?>


Why is the result A constructed?


Reply to discussion (solution)

If it is not your handout transcript error, you can only say "mentor" is talking nonsense!

Ask .... People ,,,

If it is not your handout transcript error, you can only say "mentor" is talking nonsense!

You mean the teacher is messing around.

Regardless of the facts, isn't it a nonsense?

Regardless of the facts, isn't it a nonsense?

Well, he can't see it in his 149 lecture.

I don't know. I haven't seen it.

I don't know. I haven't seen it.

Does the moderator think this is correct?

Except ① ②, ③ is incorrect, and others are not accurate.

Maybe it's the php version. I don't know it.

Isn't extends A equal to A new?

See clearly. It is about the constructor. ④ Is it true?

3 is wrong, and the result is better than words

Run the code test and you will know that 3 is wrong, but it may be because php4 is like this.
I have not read what I have told you. I don't know when the tutorial will be. if it's a php4 tutorial, I suggest you stop reading it.

Unless the subclass has its own constructor, the constructor of the parent class is executed.

 

Run the code test and you will know that 3 is wrong, but it may be because php4 is like this.
I have not read what I have told you. I don't know when the tutorial will be. if it's a php4 tutorial, I suggest you stop reading it.

Unless the subclass has its own constructor, the constructor of the parent class is executed.

 

There are some worth reading tutorials... For example, in mysql, I recently watched but couldn't find any good videos.

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.