why instance? what are the uses of instance?

Answer Posted / navin c. pandit

The object of a class is called as Instance & the process is
called as Instantiation.

To access or to call a member of a class we need instance.

eg.

public class myClass
{
public myClass()
{
}

public string show()
{
return "Hello India!";
}
}

To access method show(), we need instance of the class
myClass. And the code will be as:-
myClass obj_mc = new myClass()
string str=obj_mc.show();

Now str contains string value 'Hello India!'

Hope u have got the point.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which sorting algorithm is best?

744


Why does my windows application pop up a console window every time I run it?

739


Which is better interface or abstract class in c#?

596


Can you mark static constructor with access modifiers?

733


What is expression tree in c#?

686


What method is used to sort the elements of the array in descending order?

738


Explain how to parse a datetime string?

676


Define mutex in C#?

812


Explain About Global.asax

729


What is a delegate in c#?

684


Explain the mechanism of VB.NET/C# achieve polymorphism?

743


Explain about generics in c#.net?

723


Describe a Struct ?

743


Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?

744


Is string value type c#?

667