Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
HI,

What is the meaning when we declare variables as

private int a=10;
protected string message="";
public int b=10;

at class level in c#.net .aspx page.(server side)
Posted

I think info is well hidden in the documentation: "Access Modifiers (C# Reference)".
:)
 
Share this answer
 
private int a=10;
Means its a private variable and you can not access it in child class derived from base class containing this variable.
You can access it within parent class only..

protected string message="";
Means it is also kinda private variable which can be accessed within parent class and immediate derived class

public int b=10;
Means you can access it all over you program

Hope this helps you
Regards. :-O
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900