Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
Encapsultion doubt in my code
November 26, 2010
I am using code like this in Business Logic.Can u explian the below whether i am using Encapsulation concept in the below code.Also tell me why i should use private for declaring variable _Region and public for the property Region
private string _Region;
public string Region
Posted Date: November 27, 2010 Points: 5
_Region is a private variable because the scope of the variable is with in the class only.But,The property is a public property of the entire project.
If you want to use _Region as another class private variable you can use..
Posted Date: December 01, 2010 Points: 5
_Region is the "member variable" of the class.
Region is the "Property variable" of the class.
When you access the Region(Property) in another class.
The Property variable is changing through the Member variable (_Region)..
To post reply
Related Questions Related Questions
Code Logic doubt for 2 D Array
Encapsulation Doubt in my code
What is Code Access Security in .NET
Having a doubt in SQL query
Doubt on ''createuserwizard'' control?
protection in C#.NET source code
Doubt in Date/time
Doubt on features of .NET Framework
Have doubt in store procedure in sql server
Latest Forum Questions From The Same Category
How do i get payment status in redirect page using bitpay?
Login with Facebook and Save details in database
Login with facebook account in my website
How to make a nested datalist control?
What class does Icon derive from?
What are the validation controls?
What''s the difference between an interface and abstract class?
How to read Unicode form PDF File and Save into DataBase ?
How to identify the color format of eps/tiff using c#?
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend