Midterm Flashcards
(23 cards)
What are the 2 types of data storage?
- Mutable
- Immutable
What is mutable data storage?
Data that can be changed by the running program
What kind of data are C# strings?
Immutable
What is Parametric Polymorphism?
The use of Generic types
What is an open type regarding generics?
Declaration involves a type parameter
What is a closed type regarding generics?
Every aspect of the type is known precisely
What is Unbound Form?
Generic type where none of the type parameters have been provided with type arguments
What is the opposite of unbound form?
Bound Form or Constructed Type
How do you specify only value types?
where T : struct
How do you specify only reference types?
where T : class
How do you specify the type must have a default constructor?
where T : new()
What is a delegate?
Objectified function/method
What 3 pieces of information are in a delegate?
- Address of the method on which it makes calls
- Parameters of the method
- Return type of the method
What is comparable to a delegate in C/C++?
Function pointer
How do you declare a delegate?
delegate void MyDelegate (int x, int y);
What are the 2 types of delegates?
- Singlecast
- Multicast
What kind of delegate accepts one or more arguments without a return value?
Action<>
What kind of delegate accepts one or more arguments and returns a value?
Func<>
What is the class that raises an event called?
Publisher
What is the class that handles an event called?
Subscriber
What are the steps to make a publisher?
- Declare a delegate
- Declare the event
How do you set up a subscriber?
The += operator
NameOfObject.NameOfEvent += new
RelatedDelegate (functionToCall);