Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

A Programmer’s Introduction to C# 2.0Member Accessibility and Overloading

A Programmer’s Introduction to C# 2.0: Member Accessibility and Overloading CHAPTER 7 ■ ■ ■ Member Accessibility and Overloading One of the important decisions to make when designing an object is how accessible to make the members. In C#, you can control accessibility in several ways. Class Accessibility The coarsest level at which accessibility can be controlled is at the class. In most cases, the only valid modifiers on a class are public, which means everybody can see the class, and internal. The exception to this is nesting classes inside of other classes, which is a bit more complicated and is covered in Chapter 8. The internal modifier is a way of granting access to a wider set of classes without granting access to everybody, and it’s most often used when writing helper classes that should be hidden from the ultimate user of the class. In the .NET runtime world, internal equates to allowing access to all classes that are in the same assembly as this class. ■Note In the C++ world, such accessibility is usually granted by using friends, which provide access to a specific class. The friend specifier provides greater granularity in specifying who can access a class, but in practice the access provided by internal is http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png

A Programmer’s Introduction to C# 2.0Member Accessibility and Overloading

Editors: Gunnerson, Eric; Wienholt, Nick

Loading next page...
 
/lp/springer-journals/a-programmer-s-introduction-to-c-2-0-member-accessibility-and-NorFp60m3h
Publisher
Apress
Copyright
© Apress 2005
ISBN
978-1-59059-501-5
Pages
53 –60
DOI
10.1007/978-1-4302-0035-2_7
Publisher site
See Chapter on Publisher Site

Abstract

CHAPTER 7 ■ ■ ■ Member Accessibility and Overloading One of the important decisions to make when designing an object is how accessible to make the members. In C#, you can control accessibility in several ways. Class Accessibility The coarsest level at which accessibility can be controlled is at the class. In most cases, the only valid modifiers on a class are public, which means everybody can see the class, and internal. The exception to this is nesting classes inside of other classes, which is a bit more complicated and is covered in Chapter 8. The internal modifier is a way of granting access to a wider set of classes without granting access to everybody, and it’s most often used when writing helper classes that should be hidden from the ultimate user of the class. In the .NET runtime world, internal equates to allowing access to all classes that are in the same assembly as this class. ■Note In the C++ world, such accessibility is usually granted by using friends, which provide access to a specific class. The friend specifier provides greater granularity in specifying who can access a class, but in practice the access provided by internal is

Published: Jan 1, 2005

There are no references for this article.