🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #230467

parent::__construct() w modelach aplikacji CodeIgniterowych

#230467
From: jivanmukta
Date: Sun, 13 Jul 2014 15:18
24 lines
1868 bytes
Napisałem tak:

<?php
class Bazowa {
	public function __construct() {
		echo 'Bazowa';
	}
}
class Pochodna extends Bazowa {
}
$obiekt = new Pochodna();		

i wyświetliło się: Bazowa. Czyli konstruktor jest widoczny w klasie Pochodna.
Dlaczego w takim razie w przykładowych aplikacja CodeIgnitera programiści wołają konstruktor klasy bazowej CI_Model:

class Sample_model extends CI_Model {
	public function __construct() {
		parent::__construct();
	}
        ...
}

Przecież konstruktor Sample_model::__construct w ogóle nie jest potrzebny!
Proszę o wytłumaczenie.
Technical Details
Message-ID: <d396da14-6198-4504-9cb0-2e342f664d97@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!feeder.erje.net!us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!j15no291792qaq.0!news-out.google.com!bp9ni9igb.0!nntp.google.com!h18no323566igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Received: by 10.224.172.193 with SMTP id m1mr5281770qaz.8.1405264726562;        Sun, 13 Jul 2014 08:18:46 -0700 (PDT)
X-Received: by 10.182.33.97 with SMTP id q1mr21416obi.20.1405264726399; Sun, 13 Jul 2014 08:18:46 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!feeder.erje.net!us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!j15no291792qaq.0!news-out.google.com!bp9ni9igb.0!nntp.google.com!h18no323566igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.php
Date: Sun, 13 Jul 2014 08:18:46 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.31.3.132; posting-account=Fd8BNwoAAACl8PCi6-fI0bkHGOgt6LMa
NNTP-Posting-Host: 83.31.3.132
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d396da14-6198-4504-9cb0-2e342f664d97@googlegroups.com>
Subject: parent::__construct() w modelach aplikacji CodeIgniterowych
From: jivanmukta@poczta.onet.pl
Injection-Date: Sun, 13 Jul 2014 15:18:46 +0000
Lines: 26
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit