C Sharp Classes and Objects
Terms
undefined, object
copy deck
- Name the 5 access modifiers in C#
-
public, private, protected, internal, protected internal
-
What does it mean to overload a method?
- To create another method with the same name but with a different type or number of parameters.
-
What is a class?
-
A class defines a type. It encapsulates the types methods an properties
-
What is a constructor?
- The method that is invocked when you instantiate an object. The job of the contructor is to put the object in a valid state.
-
What is the difference between an instance member and a static member?
- Instance members are associated with instances of a type, while static members are considered to be part of the class.
- What is the function of the ref parameter modifier?
- The ref parameter modifier is used to pass value objects into a method by reference.
-
What is the primary purpose of the readonly keyword?
- To mark a static value a constant.
- What restrictions does the internal access modifier enforce?
- The internal access modifier restricts access of members of class A to any class in A's assembly.
- What restrictions does the private access modifier enforce?
- The private access modifier restricts access of members of class A to methods of class A.
- What restrictions does the protected access modifier enforce?
- The protected access modifier restricts access of members of class A to methods of class A and to methods of classes derived from class A.
- What restrictions does the protected internal access modifier enforce?
-
The protected internal access modifier restricts access of members of class A to methods of class A, methods of classes derived from class A, and to any class in class A's assembly.
-
What restrictions does the public access modifier enforce?
- None. Methods marked pubilc are visibile to any method of any class.