ㅣ
객체지향이란 단어가 생소하시면 OOP에 대해 공부를 하셔야 합니다.
아래는 예제입니다.
function MyObject(){ this.x = null; this.y = null; this.z = null; } MyObject.prototye.define = function(x, y, z){ this.x = x; this.y = y; this.z = z; }
MyObject.prototye.number_cal = function(){ // do something... }
MyObject.prototye.value_cal= function(){ // do something... }
이렇게 객체를 정의하고 사용할 때는
var o = new MyObject(); o.define(document.getElementById('x').value, document.getElementById('y').value, document.getElementById('z').value);
.....
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
javascript도 객체지향 처럼 코딩이 가능합니다.
객체지향이란 단어가 생소하시면 OOP에 대해 공부를 하셔야 합니다.
아래는 예제입니다.
function MyObject(){
this.x = null;
this.y = null;
this.z = null;
}
MyObject.prototye.define = function(x, y, z){
this.x = x;
this.y = y;
this.z = z;
}
MyObject.prototye.number_cal = function(){
// do something...
}
MyObject.prototye.value_cal= function(){
// do something...
}
이렇게 객체를 정의하고 사용할 때는
var o = new MyObject();
o.define(document.getElementById('x').value, document.getElementById('y').value, document.getElementById('z').value);
.....
댓글 달기