Last active
August 29, 2015 13:59
-
-
Save codersofthedark/10448943 to your computer and use it in GitHub Desktop.
Example of Inheritance in JAVA SCRIPT
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
<script> | |
function A() | |
{ | |
this.a = 5; | |
} | |
function B(x, y) | |
{ | |
this.b = x; | |
this.prototype = new A(); | |
} | |
function C() | |
{ | |
var obj = new B(10,15); | |
obj.a = 100; | |
obj.b = 50; | |
alert(obj.a); | |
alert(obj.b); | |
} | |
C(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment