• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Objects

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are Nameless Objects? What is their usage. I want a detailed description. One more clarification. What is the difference between Templates in C++ and Collections in Java?
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a detailed description of anonymous (nameless) objects, read Thinking in Java. I've seen them used for very small event listeners.
The main difference between collections and templates is typesafty. What you get out of a collection is of type object, and you have to perform a cast to work with it. Containers in C++, wich are based on templates, are instantiated with a type, and you get an object of that type out of them.
Again, for details read the book by Bruce Eckel. There's a free download availabel at bruceeckel.com, and it's really great.
BTW, Java 1.5 will have a feature called generics, wich is very much the same as templates.
[ April 07, 2004: Message edited by: Tobias Hess ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic