SitePoint Sponsor

User Tag List

Page 4 of 4 FirstFirst 1234
Results 76 to 77 of 77
  1. #76
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a quirk?

    I basically assumed that when I instantiate a child class the parent class would also be instantiated, however this is not the case. Fortunately I found this which explained what was going on and I since use parent::__construct.

    Does anyone else find it weird that it works like that? I don't know if I read in my java book that java will instantiate the parent or what, but I "assumed too much".
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development

  2. #77
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe I've just got used to a language I "grew up" in but I think that's the best way to do it. Derived classes should always be free to override anything higher up the inheritance hierarchy. This also rules out the use of final and private.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •