Can a static method can access non-static members and non-static methods can access static members?

Posted by Rajendra.prasad under C# on 5/12/2011 | Points: 10 | Views : 3280 | Status : [Member] | Replies : 3
Hi,
Can a static method can access non-static members and non-static methods can access static members?

Regards,
Rajendra




Responses

Posted by: Ndebata on: 5/12/2011 [Member] Starter | Points: 25

Up
0
Down
Hi

As static methods are created irrespective of objects creation( which is the process of generating non static members).
You can not access non static members in a static method.
But the reverse is true, you can access a static member from non static method.

Thanks,
Debata

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

Posted by: Lakn2 on: 5/13/2011 [Member] Starter | Points: 25

Up
0
Down
ya static methods can access non static members but not static methods can't access static members

Thanks&Regards
LakshmiNarayana Nalluri.

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

Posted by: Nithadeepak on: 5/13/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,
refer this link too...
http://results.mathrubhumi.com/election/index.html
Thanks,

Nitha Deepak

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

Login to post response