PHP - OOP [Declaring Class]


Declaring Methods 

class Person {
    var $name;
    function get_name ( ) {
        return $this->name;
    }
    function set_name ($new_name) {
        $this->name = $new_name;
    }
}

Declaring Properties

class Person {
    function get_name ( ) {
        return $this->name;
    }
    function set_name ($new_name) {
        $this->name = $new_name;
    }
}

Inheritance 

class Person {
    var $name, $address, $age;
}
class Employee extends Person {
    var $position, $salary;
}

คำสำคัญ (Tags): #tutorial#oop#php
หมายเลขบันทึก: 64180เขียนเมื่อ 29 พฤศจิกายน 2006 16:00 น. ()แก้ไขเมื่อ 11 กุมภาพันธ์ 2012 16:33 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (2)
อย่ากได้ เอกสารปะ มีเยอะ แต่ไม่มีเวลาอ่าน

อยากได้ค่ะ ส่งไฟล์ให้หน่อย ขอขอบคุณล่วงหน้า

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท