why user defined static methods are not posible to call with object ?

Posted by Harieswer under C# on 5/30/2015 | Points: 10 | Views : 1170 | Status : [Member] | Replies : 1
class Sample
{
public static void main(String args[])
{
Console.WriteLine("welcome to dotnet");
Sample s=new Sample();
s.norm();
//s.norms();
Sample.norms();
}
public void norm()
{
Console.WriteLine("checking inside method of main class");
}
public static void norms()
{
Console.WriteLine("checking the static method");

}


}




Responses

Posted by: Yesi on: 6/3/2015 [Member] Starter | Points: 25

Up
0
Down
Your question is not clear, u mean why static methods are not possible to call with object ?actually we use object to call them,and they can't be altered.

--------------------------------------------------
Free .NET WORD library http://www.e-iceblue.com/Introduce/word-for-net-introduce.html supporting editing and conversion of Word files.

Harieswer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response