diff --git "a/\350\246\203\346\270\270/20220510\351\235\231\345\244\234\346\200\235\344\275\234\344\270\232\345\222\214\347\254\224\350\256\260.md" "b/\350\246\203\346\270\270/20220510\351\235\231\345\244\234\346\200\235\351\242\230\347\233\256.md" similarity index 100% rename from "\350\246\203\346\270\270/20220510\351\235\231\345\244\234\346\200\235\344\275\234\344\270\232\345\222\214\347\254\224\350\256\260.md" rename to "\350\246\203\346\270\270/20220510\351\235\231\345\244\234\346\200\235\351\242\230\347\233\256.md" diff --git "a/\350\246\203\346\270\270/20220511\344\270\211\345\244\247\344\275\234\344\270\232.md" "b/\350\246\203\346\270\270/20220511\346\261\275\346\260\264\345\222\214\344\270\211\350\247\222\345\275\242.md" similarity index 100% rename from "\350\246\203\346\270\270/20220511\344\270\211\345\244\247\344\275\234\344\270\232.md" rename to "\350\246\203\346\270\270/20220511\346\261\275\346\260\264\345\222\214\344\270\211\350\247\222\345\275\242.md" diff --git "a/\350\246\203\346\270\270/20220516\346\225\260\347\273\204\344\272\224\345\260\217\351\242\230.md" "b/\350\246\203\346\270\270/20220516\346\225\260\347\273\204\344\272\224\345\244\247\351\242\230.md" similarity index 100% rename from "\350\246\203\346\270\270/20220516\346\225\260\347\273\204\344\272\224\345\260\217\351\242\230.md" rename to "\350\246\203\346\270\270/20220516\346\225\260\347\273\204\344\272\224\345\244\247\351\242\230.md" diff --git "a/\350\246\203\346\270\270/20220517\351\235\242\345\220\221\345\257\271\350\261\241\344\270\211\345\244\247\351\242\230.md" "b/\350\246\203\346\270\270/20220517\351\235\242\345\220\221\345\257\271\350\261\241\344\270\211\345\244\247\351\242\230.md" new file mode 100644 index 0000000000000000000000000000000000000000..38206cfe5a851e616cfccf03d7fde303e4b249f5 --- /dev/null +++ "b/\350\246\203\346\270\270/20220517\351\235\242\345\220\221\345\257\271\350\261\241\344\270\211\345\244\247\351\242\230.md" @@ -0,0 +1,158 @@ +```php + + +brand = $brand; + $this->price = $price; + } + + //输出 + function show(){ + echo $this->brand."车的价格为:".$this->price; + } + + /** + * @return mixed + */ + public function getBrand() + { + return $this->brand; + } + + /** + * @param mixed $brand + */ + public function setBrand($brand): void + { + $this->brand = $brand; + } + + /** + * @return mixed + */ + public function getPrice() + { + return $this->price; + } + /** + * @param mixed $price + */ + public function setPrice($price): void + { + $this->price = $price; + } + +} + + +$a= new Car("路虎","100万"); + $a->show(); + +echo "
"; + + +//2、在上例的基础上为汽车类定义一个子类——跑车类。 +//为子类实例化对象并访问父类的属性。 + class pp extends Car{ + function __construct($brand, $price) + { + parent::__construct($brand, $price); + } + function run(){ + echo parent::getBrand()."车的价格为:".parent::getPrice(); + } + + } +$b= new pp("迪奥","300万"); + $b->run(); + +echo "
"; + +//3、定义一个类,分别定义3个公共的属性和方法, +//3个受保护的属性和方法,3个私有属性和方法。 + +class lei{ + public $a; + public $b; + public $c; + protected $d; + protected $e; + protected $f; + private $g; + private $h; + private $i; + /** + * @return mixed + */public function getG() +{ + return $this->g; +}/** + + * @param mixed $g + */public function setG($g): void + { + $this->g = $g; + }/** + + * @return mixed + */public function getH() + { + return $this->h; + }/** + + * @param mixed $h + */public function setH($h): void + { + $this->h = $h; + }/** + + * @return mixed + */public function getI() + { + return $this->i; + }/** + + * @param mixed $i + */public function setI($i): void + { + $this->i = $i; + } + function a(){ + + } + function b(){ + + } + function c(){ + + } + protected function d(){ + + } + protected function e(){ + + } + protected function f(){ + + } + private function g(){ + + } + private function h(){ + + } + private function i(){ + + } + } +``` +