* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Microsoft.Web.Atlas / Test / standalone / script_samples / inheritance.html
1 <!-- adapted from the inheritance example at: http://atlas.asp.net/quickstart/atlas/doc/javascript/default.aspx -->
2 <html>
3 <head>
4 <script type="text/javascript" src="../../ScriptLibrary/AtlasCore.js"></script>
5 <script type="text/javascript">
6 Type.registerNamespace("Demo");
7
8 Demo.Person = function(firstName, lastName, emailAddress) {
9     var _firstName = firstName;
10     var _lastName = lastName;
11     var _emailAddress = emailAddress;
12     
13     this.getFirstName = function() {
14         return _firstName;
15     }
16
17     this.getLastName = function() {
18         return _LastName;
19     }
20
21     this.getName = function() {
22         return _firstName + " " + _lastName;
23     }
24
25     this.getEmailAddress = function() {
26         return _emailAddress;
27     }
28
29     this.dispose = function() {
30         alert('bye ' + this.getName());
31     }
32 }
33 Type.registerClass('Demo.Person', null, Web.IDisposable);
34
35 Demo.Person.prototype.toString = function() {
36     return this.getName() + ' (' + this.getEmailAddress() + ')';
37 }
38
39 Demo.Employee = function(firstName, lastName, emailAddress, team, title) {
40     Demo.Employee.initializeBase(this, [firstName, lastName, emailAddress]);
41     
42     var _team = team;
43     var _title = title;
44     
45     this.getTeam = function() {
46         return _team;
47     }
48     this.setTeam = function(team) {
49         _team = team;
50     }
51     this.getTitle = function() {
52         return _title;
53     }
54 }
55 Type.registerClass('Demo.Employee', Demo.Person);
56
57 Demo.Employee.prototype.toString = function() {
58     return Demo.Employee.callBaseMethod(this, 'toString') + '\r\n' + this.getTitle() + '\r\n' + this.getTeam();
59 }
60
61 var Frank = new Demo.Person ("Frank", "Smith", "franksmith@yoyodyne.com");
62 alert (Frank.toString());
63
64 var Molly = new Demo.Employee ("Molly", "Hatchett", "molly@whoknew.com", "Marketing", "Vice President");
65 alert (Molly.toString());
66
67 </script>
68 </head>
69 </html>