View Full Version : สงสัยเรื่อง constructer ใน php 5 ครับ
eaknarak
19-10-2006, 10:18 PM
อันนี้เป็นโค้ด php ที่ผมเขียนครับ ผมใช้ php 5.1.6
[code]
<?php
class B1
{
asylu3
20-10-2006, 11:32 PM
Note: Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required.
Reference: http://th2.php.net/manual/en/language.oop5.decon.php
Try this
[code]<?php
class BaseClass {
eaknarak
20-10-2006, 11:48 PM
ขอบคุณนะครับ ตอบปุ้บ ผมกระจ่างเลยครับ หายโง่ขึ้นมาทันตาเห็น ...
หลังจากส่งสัยมานานว่าทำไม มันไม่ยอมเรียก Constructor คลาสแม่ซะที
ความรู้คราวนี้ จำไปนานเลย ...
Powered by vBulletin® Version 4.2.5 Copyright © 2026 vBulletin Solutions Inc. All rights reserved.