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 |
How to find the current application file path while runtime?
What is Serialization and how do we implement (in real time scenario)
What is a clr (common language runtime)?
What does mean c#?
What is overriding in c#?
Are constructors inherited c#?
Trace the O/p for a program on inheritance and Polymorphism. 3 classes A,B,C A with two methods public virtual SomeMethodA public virtual SomemoreMethodA B:A overide SomeMethodA C:B new Method SomeMethodA override SomeMoreMethodA main method { b new instance of B b.SomeMethodA b.SomeMoreMethodA b1 new instance of C b1.SomeMethodA b1.SomeMoreMethodA }
Is collection a data structure?
Distinguish between continue and break statement?
What is data type in c# with example?
What is datetime parse in c#?
What?s the top .NET class that everything is derived from?
4 Answers Hindawi, Siebel, Visual Soft,