Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Internet & the Web (https://www.askmehelpdesk.com/forumdisplay.php?f=177)
-   -   PHP5 Screwy Inherritance (https://www.askmehelpdesk.com/showthread.php?t=18004)

  • Jan 16, 2006, 10:38 PM
    Ademan
    PHP5 Screwy Inherritance
    Ok, I have this lovely situation, lets say I have 3 classes, A, B, and C.
    C derives from B which derives from A (extends).
    A defines the member function foo.
    B doesn't do anything regarding foo.
    C wants to redefine foo.

    QUESTION: does ignoring an inherrited member function mark it implicitly as final?

    Here's "sample" code

    Class A
    {
    Function foo()
    {
    //some function body
    }
    }

    Class B extends A
    {
    //anything not regarding foo
    }

    Class C extends B
    {
    Function foo()
    {
    //redefined body
    }
    }

    The problem is when I try and call foo from a class C, I get an error (it looks like $this is not defined)

    Thanks a lot
    -Dan
  • Jan 19, 2006, 10:33 PM
    Ademan
    Well, as it turns out the problem was elsewhere, meh. The example I have is perfectly valid.

    Cheers
    -Dan

  • All times are GMT -7. The time now is 04:49 AM.