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 the scope of anonymous type ?
What are the examples of data types?
Explain the difference between pass by value and pass by reference.
What is namespace explain with example?
What is class method c#?
What is ienumerable t in c#?
What are the types of inheritance in c#?
What is a datacontract?
What is serialization in .net?
What is a static in c#?
What is the name of the implicit input parameter of a set accessor for any property?
Which attribute adorn a test class to be picked up by the NUnit GUI in the NUnit test framework?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)