Jump to content

mkaminski

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mkaminski's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, Say I have a class such as this.. class A { public function sayHello() {   print("hello"); } } class B extends A { public function sayHello() {   print("A more refined hello...perhaps bonjour?"); } } $object = new b(); Now $object is of type B. Calling $object->sayHello() would output "A more refined hello...perhaps bonjour?" Now how can I call the sayHello() so that it will call the A class' sayHello() method, simply outputting "hello"? I know how to do this in Java...it would just be a simple type cast... but how can this be done in PHP 5? I want to change the type of the object, not do a parent::sayHello() in class B's sayHello() method. Thanks!
×
×
  • Create New...

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.