Encapsulation
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| This article—Encapsulation—is from Head First C#, by Andrew Stellman, Jennifer Greene. Copyright © 2007 O'Reilly Media. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET. Read the book review! |
|
Keep your privates private
Ever wished for a little more privacy?
Sometimes your objects feel the same way. Just like you don’t want anybody you
don’t trust reading your journal, or paging through your bank statements, good objects
don’t let other objects go poking around their properties. In this chapter, you’re going
to learn about the power of encapsulation. You’ll make your object’s data private,
add methods to protect how that data is accessed.
|



