5. Declaring a class
The class name
Bank
The members of the class
Fields
BankName
Methods
GetAccounts
The characteristics of the class
Public or Private
7. Class Members
Fields – A field is variable that belongs to
a class
It can be any type, either predefined or user-
defined
Like all variables, fields store data, and have
the following characteristics
They can be written to
They can be read from
9. Class Members
Methods - A method is a named block of
executable code that can be executed fro
m many different parts of the program, an
d even from other programs
Return type
Name
Parameter list
Method body
14. Access Modifiers
Private Access - Private members are only accessible
from within the class in which they are declared-other
classes cannot see or access them
Private access is the default access level-so if a
member is declared without an access modifier, it is a
private member
15. Access Modifiers
Public Access - Public members are accessible to all
other objects in the program. You must use the public ac
cess modifier to specify public access
36. Member Access Modifiers
public
All classes both inside and outside the assembly have
free access to the member
private
A private class member can be accessed only by
members of its own class. It cannot be accessed by
other classes, including classes that are derived from
it
A private member can, however, be accessed by
members of classes nested in its class
37. Member Access Modifiers
protected
The protected access level is like the private
access level, except that it allows classes
derived from the class to access the member
internal
Members marked internal are visible to all the
classes in the assembly, but not to classes
outside the assembly
38. Member Access Modifiers
protected internal
Members marked protected internal are
visible to all the classes that inherit from the cl
ass, and also to all classes inside the assembl
y