php面向对象中对属性和方法定义的问题
<?phpclassApplication_Model_Guestbook{protected$_comment;protected$_created;protected...
<?php
class Application_Model_Guestbook
{
protected $_comment;
protected $_created;
protected $_email;
protected $_id;
public function __set($name, $value);
public function __get($name);
?>
问题:
为什么一般属性如$_comment要定义成protected,方法要定义成
public ? 展开
class Application_Model_Guestbook
{
protected $_comment;
protected $_created;
protected $_email;
protected $_id;
public function __set($name, $value);
public function __get($name);
?>
问题:
为什么一般属性如$_comment要定义成protected,方法要定义成
public ? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询