Re: Using a Resource as a Class Property



Michael Fesser wrote:
.oO(Sanders Kaufman)

class my_childclass extends my_baseclass {
function my_childclass() {
// first call parent constructor or we won't have a database ...
parent::my_baseclass();
// then do some other stuff
...


OK - that seems to be where I went wrong. I thought the base class's constructor was automatically called when the extended class's was.

So, bottom line, what you're saying here is that when you extend a base class like this, you still have to manually call the base class's constructor? Zat right?
.



Relevant Pages

  • Re: How to correctly by pass "protected"
    ... > protected int getSkillGroupId(); ... > copy constructor) That was basically a thin wrapper to expose the ... Extend their event class with a class that holds an instance of the ... its static methods to extract data from SkillGroupEvents -- no copying, ...
    (comp.lang.java.programmer)
  • Re: Useful classical inheritance example?
    ... Future Reserved Words in ECMA 3 ... to by Function.prototype with an extend() method instead. ... this is particularly useful if a constructor calls the "parent" ... In class-based inheritance this is ...
    (comp.lang.javascript)
  • Re: auto construct parent class
    ... I have an AppController and some classes that extend the controller. ... class UsersController extends AppController ... Although the function name is different, the parent constructor will be called if you haven't defined a constructor in your child class, without you having to specify it. ...
    (comp.lang.php)
  • Re: Get a variable value from the calling class
    ... would be audi ... The legit way is to pass a parameter in the constructor. ... extend the class to a debugging version that supports the extra field. ...
    (comp.lang.java.programmer)
  • Re: Extending java.io.File
    ... Are we permitted to extend java.io.File. ... Note that when you do not provide a constructor, javac will create a parameterless default constructor: ... Further note that every constructor in java implicitely calls the parameterless super-constructor if you do not call a superconstructor explicitely: ...
    (comp.lang.java.help)