To instantiate an object, simply declare a reference and use the new keyword to create an instance for that reference:
Here I assume that you have already written the declaration for MyClass. It must include a constructor that takes no arguments. If you wish to use a constructor that takes arguments, you put them inside the () as you would with a regular function call. Since the API already has a lot of classes declared for you, you may wish to instantiate one of them first since you wouldn't have to write all the code for a class that way. HTH Layne
My class is smarter than siu's, it can write chinese with its feet:
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Jan 04, 2003
hi Rupinder CCNA is about the network application. Some hardware are developed by CISCO. humm..... Can you point out where Michael instantiate an object in the code? If you can point out where,I think you can understand the concept of instantiate an object. Michael is a funny bartender who always help people to answer the question, and the code is funny too,isn't it?