我从PHP和快速的学习OOP的Python基础PHP的例如知识 我有一个类快速概述面向python的OOP php?
<?php
class Cat{
private $name;
private $age;
private $color;
public function getName()
{
return $this->name;
}
public function setName($value)
{
$this->name = $value;
}
public function getAge()
{
return $this->age;
}
public function setAge($value)
{
$this->age = $value;
}
public function getColor()
{
return $this->color;
}
public function setColor($value)
{
$this->color = $value;
}
}
?>
什么是等价于Python的OOP代码?
+1是属性的一个很好的例子。 – delnan 2011-03-15 19:28:58
很好的解释,谢谢 – kn3l 2011-03-16 07:47:45