Ask Experts Questions for FREE Help !
Ask
    Ademan's Avatar
    Ademan Posts: 40, Reputation: 11
    Junior Member
     
    #1

    Jan 16, 2006, 10:38 PM
    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
    Ademan's Avatar
    Ademan Posts: 40, Reputation: 11
    Junior Member
     
    #2

    Jan 19, 2006, 10:33 PM
    Well, as it turns out the problem was elsewhere, meh. The example I have is perfectly valid.

    Cheers
    -Dan

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Php_write in php5 gives cannot read error [ 3 Answers ]

Hi, I have used php_write function in PHP4 and it works fine, I have updated my codes to PHP5, I have changed some codes for this and when I use this function php_write php5. Please if anybody knows why it happened help to me. Thank you

Php5 mysql hosting [ 11 Answers ]

I am looking to hopefully move my web page off my home server (when its complete) to a more capable hosting solution. All I really require of the server is that it supports PHP5 and some fairly recent version of MySQL (although I'm not particularly picky about the MySQL part). Storage and max...


View more questions Search