"new class" in GTK code....

  • Thread starter Christian Williamson
  • Start date
C

Christian Williamson

Can anyone tell me right off why the keywords "new class" are used in
the following code, rather than just "new"? Why the word "class"? I know
it's a keyword, but I thought all you needed was new and delete.

Thanks.

Gtk::Label *label = Gtk::manage(new class Gtk::Label("Hello"));
 
P

Piotrek

Can anyone tell me right off why the keywords "new class" are used in
the following code, rather than just "new"? Why the word "class"? I know
it's a keyword, but I thought all you needed was new and delete.

Thanks.

Gtk::Label *label = Gtk::manage(new class Gtk::Label("Hello"));

I believe it is to specify precisely which type definition you're
referring to, i.e.:

class A {};
int main()
{
int A; // local variable 'A' hides the class name 'A'

class A a; // OK - got past the name hiding by using 'class'
}

Piotrek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top