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
Can a dictionary have the same key?
What do you mean by thread safe in c#?
What is file extension of webservices?
What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place?
What is the difference between hashtable and dictionary in c#?
What is wpf application in c#?
Which is better javascript or c#?
Explain About Virtual functions and their use.
How we can create an array with non-default values?
How to parse a date time string?
In .NET how can you solve the DLL Hell problem?
What is array and its types in c#?
What is a generic method?
What is boolean method?
What is the difference between field and property in c#?