<?php
//定义类
class Cat{
var $age;
var $color;
function setAge($var1){
$this->age=$var1;
}
function getAge(){
echo $this->age;
}
function setColor($var1){
$this->color=$var1;
}
function getColor(){
echo $this->color;
}
}
$mycat=new Cat();
$mycat->setAge(10);
$mycat->setColor("red");
$mycat->getAge();
$mycat->getColor();
?>
//定义类
class Cat{
var $age;
var $color;
function setAge($var1){
$this->age=$var1;
}
function getAge(){
echo $this->age;
}
function setColor($var1){
$this->color=$var1;
}
function getColor(){
echo $this->color;
}
}
$mycat=new Cat();
$mycat->setAge(10);
$mycat->setColor("red");
$mycat->getAge();
$mycat->getColor();
?>