app/test/prototype_oblit_constructor.js
raw| 1 | /** @constructor */ |
| 2 | function Article() { |
| 3 | } |
| 4 | |
| 5 | Article.prototype = { |
| 6 | /** @constructor */ |
| 7 | Title: function(title) { |
| 8 | /** the value of the Title instance */ |
| 9 | this.title = title; |
| 10 | }, |
| 11 | |
| 12 | init: function(pages) { |
| 13 | /** the value of the pages of the Article instance */ |
| 14 | this.pages = pages; |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | f = new Article(); |
| 19 | f.init("one two three"); |
| 20 | |
| 21 | t = new f.Title("my title"); |
| 22 | |
| 23 | print(f.pages); |
| 24 | print(t.title); |