# Base and derived class construction

- Thread: https://externals.io/message/10797
- Original archive: https://news-web.php.net/php.internals/10797
- Started by Jason Davidson on 2004-06-27T06:44:45+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10797 — Jason Davidson — 2004-06-27T06:44:45+00:00

URL: https://externals.io/message/10797#10797

which languages is this normal too.. 
if you refer to java, that uses the 'super' function, you need only
explicitly call super if your constructor has arguments, otherwise an
implicit call is made to the parents defualt constructor ( one with
arguments).  
c++ also will call the parent defualt constructor automatically as well
i beleive.  
that aside, i do release my mistake in the workaround,  ive noted the
use of parent::__construct().
im not really concerned with coding, i was more simply interested in why
it was done this way,  in such a way, that a child class can be
inherited with parent class construction.

Jason

Stefan Walk               <swalk@prp.physik.tu-darmstadt.de> wrote:
> 
> 
> > […]
> 
> parent::__construct(), to be exact :)
> 
> > […]
> 
> Most languages i know do that ("forcing" you to call super or alike).
> The only small "annoyance" i see is that parent::__construct() doesn't
> automatically use the parameters that were passed to the constructor,
> but i think one can live with that.
> 
> Stefan

---

## #10806 — Marcus Boerger — 2004-06-27T21:59:05+00:00

URL: https://externals.io/message/10797#10806 · In reply to: #10797

Hello Jason,

maybe this time we neither had c++ nor java in mind, this time it was
delphi.

regards
marcus


Sunday, June 27, 2004, 8:44:45 AM, you wrote:

> which languages is this normal too.. 
> if you refer to java, that uses the 'super' function, you need only
> explicitly call super if your constructor has arguments, otherwise an
> implicit call is made to the parents defualt constructor ( one with
> arguments).  
> c++ also will call the parent defualt constructor automatically as well
> i beleive.  
> that aside, i do release my mistake in the workaround,  ive noted the
> use of parent::__construct().
> im not really concerned with coding, i was more simply interested in why
> it was done this way,  in such a way, that a child class can be
> inherited with parent class construction.

> Jason

> Stefan Walk               <swalk@prp.physik.tu-darmstadt.de> wrote:
> > […]




-- 
Best regards,
 Marcus                            mailto:helly@php.net
