method1();PHP 메서드를 재정의하여 이전 메서드를 호출 할 수 있습니다.
예를 들어 method1을 method1_origin()으로 이동하고 method1_origin()을 호출 할 수있는 추가 기능과 가능성이있는 새 method1을 만들 수 있습니까?
반성이 도움이 될 수 있다고 생각하지만 어떻게해야할지 모르겠다.
method1();PHP 메서드를 재정의하여 이전 메서드를 호출 할 수 있습니다.
예를 들어 method1을 method1_origin()으로 이동하고 method1_origin()을 호출 할 수있는 추가 기능과 가능성이있는 새 method1을 만들 수 있습니까?
반성이 도움이 될 수 있다고 생각하지만 어떻게해야할지 모르겠다.
parent 함수를 호출 할 수 있습니다.
class new_object extends old_object
{
function method1()
{
// overwrite function here
}
function method1_origin()
{
// call old function
parent::method1();
}
}
당신은 클래스
class core {
public function __construct(){}
protected function method_orig()
{
}
}
을 확장 할 필요가 -
class someclass extends core{
public function __construct()
{
parent::__construct();
}
public function method_new()
{
parent::method_orig();
}
}
기본 OOP, 당신은 여기에 몇 가지 좋은 정보를 찾을 수 있습니다 http://php.net/manual/en/language.oop5.php
을