Search Webmaster Help and Solution

OOP: style question for inheritance and constructors

Is there any accepted "best practice" for when a child class has no need to overload its parent constructor method? Would you include a constructor anyway and just have its call its parents constructor so that the interface is visible in the child class (see below), or just omit it entirely?
PHP Code: class Bar extends Foo
{
   // is this desirable?
   public function __construct($parameter, $list)
   {
      parent::__construct($parameter, $list);
   }
}
Is there any accepted "best practice" for when a child class has no need to overload its parent constructor method? Would you include a constructor anyway and just have its call its parents constructor so that the interface is visible in the child class (see below), or just omit it entirely?
PHP Code: class Bar extends Foo
{
   // is this desirable?
   public function __construct($parameter, $list)
   {
      parent::__construct($parameter, $list);
   }
}

View Complete Thread with Replies

Related Items

Query failed: connection to localhost:3354 failed (errno=111, msg=Connection refused).