Search
Articles
FAQs
Login
All Questions
New Question
C# .NET - new key word
Asked By
kiruba .e
on 29-Mar-13 01:53 AM
Hi,
While creating object we use new keyword. What is the puspose of this.
Ex:
scenario 1 :
class A
{ }
main()
{
A obj1=new A();
}
What is the use of new key word. and what will happen if we do not use new key word in this.
Regards
Kiruba.e
Robbe Morris
replied to
kiruba .e
on 29-Mar-13 08:38 AM
You must first create an instance of a non static object before you can use it. That is what "new" does. Otherwise, obj1 would be null.