I have a class declared as below
public class a
{
public void add()
{}
}



What is the diference between
a a1 =new a;
and simply
a a1;

Answer Posted / pritam kumar

in a a1
It only declares an object a1 of class a but no memory is
allocted to execute the main method

where as in a a1 = new a

It declares an object and also intiate it using the new key
word.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of delegates in c#?

552


Is int a struct in c#?

585


What is thread life cycle in c#?

569


What is a value type in c#?

589


How do I unload an assembly?

598






What are the characteristics of c#?

569


What is parsing? How to parse a date time string?

616


What is tryparse c#?

600


Why do we need constructor?

570


To allow an element to be accessed using a unique key which .NET collection class is used ?

712


What is the use of ienumerable in c#?

638


Can we use "this" command within a static method?

641


Does c# support properties of array types?

614


What is gui in c#?

646


What does a constructor do c#?

570