Re: How to get the Class name of an element



On Fri, 2010-04-16 at 09:25 +0000, list guenther-sohler net wrote:
Its really a stupid question.

this is not good OOP.

if you feel the need to do a type check then you're probably doing the
wrong thing.

If I write

$text=Gtk2::Entry->new;
or
$text=Gtk2::ComboBoxEntry->new;

how can I check later in the program if $text is an Entry or an
ComboBoxEntry ?

if($text->get_text != undef)
{
}

does not help. It already tries to call an undefined function

you want UNIVERSA::isa

perldoc UNIVERSAL

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]