Skip to content

Instantly share code, notes, and snippets.

Last active July 1, 2016 10:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ksakae1216/5a6e6590ddc87757bc244bf029794193 to your computer and use it in GitHub Desktop.
function Teki(n){ = n;
Teki.prototype.appear = function(){
console.log("が あらわれた!");
Teki.prototype.attack = function(){
function Dragon(){
Dragon.prototype = new Teki;
Dragon.prototype.attack = function(){
var zako = new Teki("ザコ"); //インスタンスをつくる
var boss = new Dragon("ボス");
zako.appear(); //ザコ現れる
boss.appear(); //ボス現れる
zako.attack(); //ザコの攻撃
boss.attack(); //ボスの攻撃
ザコが あらわれた!
ボスが あらわれた!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment