O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Routine Accessibility

The section Scope, Accessibility, and Lifetime in Chapter 6, discussed when a variable exists and what pieces of code can access it. Similar concepts apply to routines.

For example, if a class defines a routine and gives it the private accessibility keyword, then it is visible only to code within the class.

Table 9-1 summarizes the accessibility keywords used by C# and Visual Basic.

Table 9-1. Accessibility Keywords

C# Keyword

Visual Basic Keyword

Meaning

public

Public

The routine is usable by any code.

private

Private

The routine is usable only by code in the same structure, class, or code module.

protected

Protected

The routine is usable only by code in the same structure or class, or in a derived class. (Chapter 10, explains derived ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required