|
1
|
- Andrew Scott
Computing Department
Lancaster University, UK
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
- Abstract definition of an object ‘characteristic’
- Includes abstract definition of
- Indexers
- Methods
- Properties
- Names should start with an I
|
|
9
|
- Classes implement one or more Interfaces
- Classes can extend only one base class
|
|
10
|
- Interface
- General characteristic: Printable
- Abstract Class
- Limited grouping: Processor
- Class
- Specific implementation: Intel Pentium III
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
- sealed
- Prevents classes inheriting from a class
|
|
16
|
- Implement IEnumerable
- IEnumerator GetEnumerator()
- For example, System.Array class
- Iterator: foreach(type var in ICollection)
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
- No inheritance
- Passed by value
- Class based objects passed by reference
- Value type and always they have value
- Cannot be null, unlike class based objects
- Can have methods and properties
- Cannot have a finalize method
|
|
21
|
|
|
22
|
|
|
23
|
- Public: Not restricted
- Protected: Containing class or types derived from it
- Internal: Current project/assembly
- Protected internal:
- Current project/assembly
- Containing class or types derived from it
- Private: Containing type
|
|
24
|
- Class [private, by default]
- Public, protected, internal, protected internal, private
- Enum [public]
- Interface [public]
- Struct [private]
- Public, internal, private
|
|
25
|
|