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;
Answers were Sorted based on User's Feedback
Answer / rahul maurya
in a a1=new a memory is allocated to the main function to execute
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / radhika
a a1;
At this stage, a1 is of type a, but it does not actually
contain the object data yet. For it to
contain the object data, you need to use the new keyword to
create a new instance of the a class,this
process is known as object instantiation :
a a1 = new a();
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
What is cookies c#?
How assembly versioning in .NET prevent DLL Hell problem?
What is protected internal modifier in C#?
What is the use of private constructor in c#?
Assembly Code. in Rejester AL. How do Contast Replece( or Change): Bit D3 With Bit D4 and Bit D2 With Bit D5 and Bit D1 With Bit D6 and Bit D0 With Bit D7 I am Not Know Very Well Write English.
What does virtual keyword mean ?
How many aware interfaces are there?
Can firstordefault return null?
What is lambda expression in c#?
What is dll file in c#?
What is a service layer c#?
What is dictionary and hashtable in c#?