Reply to Current class name for use with ::

Your name:

Reply:


Posted by Andy Jeffries on 05/03/06 15:06

OK, assuming the following class structure:

class A {
public function printConst()
{
print {something}::TEST_CONST;
}
}

class B extends A {
const TEST_CONST = 10;
}

class C extends A {
const TEST_CONST = 20;
}

So, I want to be able to do as follows:

$b = new B();
$b->printConst();
$c = new C();
$c->printConst();

What I want to know is what should go instead of {something}. I don't
want the class it's declared in, but the class it's being called from.

I'm sure there's a way to do it, I remember reading it when studying for
the ZCE, but I'm damned if I can find it now when I need it.

Cheers,


Andy


--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация