Skip to content

Instantly share code, notes, and snippets.

@codersofthedark
Last active August 29, 2015 13:59
Show Gist options
  • Save codersofthedark/10448943 to your computer and use it in GitHub Desktop.
Save codersofthedark/10448943 to your computer and use it in GitHub Desktop.
Example of Inheritance in JAVA SCRIPT
<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