hiyatran

Using Prototype

Discussion created by hiyatran on May 27, 2013
Latest reply on May 27, 2013 by vinaybansal
Here's my code:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");


var Shape = function(){}

Shape.prototype.Circle = function(){
 // Some code here
};

Shape.prototype.Square = function(){
 // Some code here
};


MainMenu.prototype = new Shape();

var MainMenu = function(ctx){
   this.draw{
 this.Circle();
 this.Square();
   }
}



What I want to do is to call the Circle() and Square() function inside my draw() function.
But it doesn't work.
Is this even possible??
I'm going crazy trying to figure this out!!

Outcomes