Last active
August 29, 2015 14:05
-
-
Save Cengizism/7c0a893113dc81a94c24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WinJS.Namespace.define('MyFactory', { | |
2.Car: WinJS.Class.define( | |
3. // Constructor | |
4. function (color, make) { | |
5. this.color = color; | |
6. this.make = make; | |
7. }, | |
8. // Instance Members | |
9. { | |
10. Accelerate: function () { | |
11. // function definition goes here | |
12. }, | |
13. | |
14. Turn: function () { | |
15. // function definition goes here | |
16. } | |
17. }, | |
18. | |
19. // Static Members | |
20. { | |
21. numberOfWheels: 4 | |
22. } | |
23.) | |
24.}); | |
25.var anotherCar = new MyFactory.Car(); | |
26.anotherCar.Accelerate(); | |
----------------------------------------------------------------------------------- | |
var class = WinJS.Class.define(constructor, instanceMembers, staticMembers); | |
Car: WinJS.Class.define( | |
2. // Constructor | |
3. function (color, make) { | |
4. this.color = color; | |
5. this.make = make; | |
6. }, | |
7. | |
8. // Instance Members | |
9. { | |
10. Accelerate: function () { | |
11. // function definition goes here | |
12. }, | |
13. Turn: function () { | |
14. // function definition goes here | |
15. } | |
16. }, | |
17. // Static Members | |
18. { | |
19. numberOfWheels : 4 | |
20. } | |
21. ); | |
22. | |
23.var myCar = new MyFactory.Car('White', 'Honda'); | |
24.myCar.Turn(); | |
----------------------------------------------------------------------------------- | |
var class = WinJS.Class.derive(baseClass, constructor, instanceMembers, staticMembers); | |
AutomaticCar: WinJS.Class.derive(Car, | |
2. function (color, make) { | |
3. }, | |
4. { | |
5. transmission: 'Automatic' | |
6. }, {} | |
7.) | |
8. | |
9.var autoCar = new MyFactory.AutomaticCar('Black', 'Audi'); | |
10.autoCar.Turn(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment