Jump to content

Archived

This topic is now archived and is closed to further replies.

hvle

virtual function in PHP?

Recommended Posts


class c1
{
virtual function func1();

}

class c2 extends c1
{
function func1()
{
// actual works done here
}

}

Is this kind of structure possible in PHP?

Share this post


Link to post
Share on other sites
[!--quoteo(post=376569:date=May 24 2006, 03:09 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 24 2006, 03:09 PM) [snapback]376569[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Yes.
[/quote]

How, would be great.

Share this post


Link to post
Share on other sites
If I understand where your going... something like....
[code]
abstract class1 {
  public abstract function foo() {}
}

class2 impliments class1 {
  public function foo() {
    return true;
  }
}
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=376586:date=May 24 2006, 04:31 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 24 2006, 04:31 PM) [snapback]376586[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If I understand where your going... something like....
[code]
abstract class1 {
  public abstract function foo() {}
}

class2 impliments class1 {
  public function foo() {
    return true;
  }
}
[/code]
[/quote]


strangely, I couldn't find any information relate to 'abstract' in the manual. There is very vague documentaion of class and OOP in PHP manual. I've found an alternative to this problem, but thanks for the info. I hope there'll be more 'doc' on this issue in the next version.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.