SlideShare une entreprise Scribd logo
1  sur  9
JavaScript による
楽しいオブジェクト指向
プログラミング
片山 真也
どう書くの?
var Drug = function(name) {
this.name = name;

};
var hoge = new Drug(“hoge”);

var foo = new Drug(“foo”);
Drug.prototype.take = function() {
// 処理
}
hoge.take();
take

Drug

prototype

constructor

hoge

foo
name

name
“hoge”

“foo”
継承
var Super = function() {};
var Child = function() {};

Child.prototype = new Super();
Super

prototype

constructor

Child
constructor

prototype

プロトタイプ
チェーン
スーパーメソッド
Super.prototype.hoge = function(arg) {};

this
this.constructor
.prototype
.hoge .call(this, arg);
プライベート変数・関数
var Drug = function() { /* 初期化*/ };
(function() {
var private = function() {};
Drug.prototype.public = function() {};

})();

Contenu connexe

Plus de kata shin

6月26日 LT会
6月26日 LT会6月26日 LT会
6月26日 LT会kata shin
 
JSSST 2014 発表資料
JSSST 2014 発表資料JSSST 2014 発表資料
JSSST 2014 発表資料kata shin
 
Generational Layered Canvas Mechanism for Collaborative Web Applications
Generational Layered Canvas Mechanism for Collaborative Web ApplicationsGenerational Layered Canvas Mechanism for Collaborative Web Applications
Generational Layered Canvas Mechanism for Collaborative Web Applicationskata shin
 
新谷研プログラミングコンテスト2014 発表資料
新谷研プログラミングコンテスト2014 発表資料新谷研プログラミングコンテスト2014 発表資料
新谷研プログラミングコンテスト2014 発表資料kata shin
 
JSAI2014 発表資料
JSAI2014 発表資料JSAI2014 発表資料
JSAI2014 発表資料kata shin
 
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワークkata shin
 

Plus de kata shin (6)

6月26日 LT会
6月26日 LT会6月26日 LT会
6月26日 LT会
 
JSSST 2014 発表資料
JSSST 2014 発表資料JSSST 2014 発表資料
JSSST 2014 発表資料
 
Generational Layered Canvas Mechanism for Collaborative Web Applications
Generational Layered Canvas Mechanism for Collaborative Web ApplicationsGenerational Layered Canvas Mechanism for Collaborative Web Applications
Generational Layered Canvas Mechanism for Collaborative Web Applications
 
新谷研プログラミングコンテスト2014 発表資料
新谷研プログラミングコンテスト2014 発表資料新谷研プログラミングコンテスト2014 発表資料
新谷研プログラミングコンテスト2014 発表資料
 
JSAI2014 発表資料
JSAI2014 発表資料JSAI2014 発表資料
JSAI2014 発表資料
 
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク
新谷・大囿研究室 2014年度引き継ぎ講習会 フレームワーク
 

Dernier

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 

Dernier (9)

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 

JavaScript による楽しいオブジェクト指向プログラミング