Advanced C#
Contents
.Inheritance
.Interfaces
.Delegates
.Exceptions
.Namespaces and Assemblies
.Attributes
.Threads
.XML Comments
…
Visibility protectedand internal
protected: Visible in declaring class and its subclasses (more restricive than in Java)
internal: Visible in declaring assembly (see later)
protected internal: Visible in declaring class, its subclasses and the declaring assembly
Example
class Stack{
protected int[] values = new int[32];
protected int top = -1;
public void Push(int x) {…}
public int Pop() {…}
}
class BetterStack: Stack {
public bool Contains(int x) {
foreach (int y in values) if (x == y) return true;
return false;
}
}
class Client {
Stack s = new Stack();
… s.values[0]…// compilation error!
}
…
Website: www.ssw.uni-linz.ac.at | Filesize: 487kb
No of Page(s): 62
Click here to download Advanced C#.
Related Tutorial
Tags: assembly, delegates, exception handling, inheritance, interface, xml string
Comments
Leave a Reply