매일 1 모드의 전략 모드

799 단어
<?php
//    :            

//        sphinx  ,           

interface indexSource{
	public function makeSource($data);
}

class Strategy{
	private $data;
	public function getData(){
		echo "    
"; $this->data = "to add "; } public function makeSource($source_class_type){ $obj = new $source_class_type; $obj->makeSource($this->data); } } class PythonSource implements indexSource{ public function makeSource($data){ echo " python
"; } } class XmlSource implements indexSource{ public function makeSource($data){ echo " xml
"; } } $strategy_obj = new Strategy(); $strategy_obj->getData(); $strategy_obj->makeSource("PythonSource"); $strategy_obj->makeSource("XmlSource");

좋은 웹페이지 즐겨찾기