-
Notifications
You must be signed in to change notification settings - Fork 1
/
2-2-bridge.vala
61 lines (48 loc) · 1.21 KB
/
2-2-bridge.vala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
interface WebPage {
//abstract constructor doesn't exist, at least that i know of
public abstract string get_content ();
}
class About : WebPage {
protected Theme theme;
public About (Theme theme) {
this.theme = theme;
}
public string get_content () {
return "About page in " + theme.get_color () + "\n";
}
}
class Careers : WebPage {
protected Theme theme;
public Careers (Theme theme) {
this.theme = theme;
}
public string get_content () {
return "Careers page in " + theme.get_color () + "\n";
}
}
interface Theme : Object {
public abstract string get_color ();
}
class DarkTheme : Object, Theme {
public string get_color () {
return "Dark Black";
}
}
class LightTheme : Object, Theme {
public string get_color () {
return "Off White";
}
}
class AquaTheme : Object, Theme {
public string get_color () {
return "Light blue";
}
}
public int main (string[] args) {
var dark_theme = new DarkTheme ();
var about = new About (dark_theme);
var careers = new Careers (dark_theme);
print ("%s", about.get_content ());
print ("%s", careers.get_content ());
return 0;
}