From 3516765ed95195ca32434689a7f3b38002a36621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E7=8E=B2?= <1851699117@qq.com> Date: Tue, 17 May 2022 16:05:31 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220517-\350\275\246.md.txt" | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 "\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" diff --git "a/\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" "b/\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" new file mode 100644 index 0000000..d6e499e --- /dev/null +++ "b/\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" @@ -0,0 +1,238 @@ +```php +brand=$brand; + $this->price=$price; + } + function hao(){ + echo $this->brand."的价格为:".$this->price; + } + + + + /** + * @return mixed + */ + public function getBrand() + { + return $this->brand; + } + + /** + * @param mixed $brand + */ + public function setBrand($brand) + { + $this->brand = $brand; + } + + /** + * @return mixed + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param mixed $price + */ + public function setPrice($price) + { + $this->price = $price; + } +} + +$ha=new car("奥迪","300000"); +$ha->hao(); + + + +echo "
"; +//2、在上例的基础上为汽车类定义一个子类——跑车类。为子类实例化对象并访问父类的属性。 + +class pao extends car{ + private $brand;//品牌 + private $price;//价格 + + + public function __construct($brand,$price) + { + $this->brand=$brand; + $this->price=$price; + } + function jiu(){ + echo $this->brand."的价格为:".$this->price; + } + + + + /** + * @return mixed + */ + public function getBrand() + { + return $this->brand; + } + + /** + * @param mixed $brand + */ + public function setBrand($brand) + { + $this->brand = $brand; + } + + /** + * @return mixed + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param mixed $price + */ + public function setPrice($price) + { + $this->price = $price; + } +} + +$y=new pao("奔驰","400000"); +$y->jiu(); + + +//3、定义一个类,分别定义3个公共的属性和方法,3个受保护的属性和方法,3个私有属性和方法。 +//3个公共的属性和方法 +class shu +{ + public $a1; + + public $a2; + + pubLic $a3; + + function name1() + { + + + echo "我叫" . $this->a1; + } + + function age1() + + { + echo "我" . $this->a2 . "岁了"; + } + + function love1() + + { + echo "我的爱好是" . $this->a3; + } + +//3个受保护的属性和方法 + + protected $b1; + + protected $b2; + + protected $b3; + + protected function name2() + { + } + + protected function age2() + + { + echo "我" . $this->a2 . "岁了"; + } + + protected function love2() + + { + echo "我的爱好是" . $this->a3; + } + + + //3个私有属性和方法 + + private $c1; + + private $c2; + + private $c3; + + private function name3() + { + } + + private function age3() + { + } + + private function love3() + { + } + + public function getC1() + + { + return $this->c1; + } + + + public function setC1($c1) + { + + $this->c1 = $c1; + } + + + public function getC2() + { + + return $this->c2; + } + + + public function setC2($c2) + { + + $this->c2 = $c2; + } + + + public function getC3() + { + + return $this->c3; + } + + + public function setC3($c3) + { + + $this->c3 = $c3; + + } +} +``` \ No newline at end of file -- Gitee From 25fe877446409f4b64dc1c5c3c9a9ccb1adc7991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E7=8E=B2?= <1851699117@qq.com> Date: Tue, 17 May 2022 16:05:50 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E6=9D=8E?= =?UTF-8?q?=E5=AE=B6=E7=8E=B2/20220517-=E8=BD=A6.md.txt=20=E4=B8=BA=20?= =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E7=8E=B2/20220517-=E8=BD=A6.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220517-\350\275\246.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" => "\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md" (100%) diff --git "a/\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" "b/\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md" similarity index 100% rename from "\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md.txt" rename to "\346\235\216\345\256\266\347\216\262/20220517-\350\275\246.md" -- Gitee From cfbba1e41c682a86fe622aeecea0cd1eaf3fb462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E7=8E=B2?= <1851699117@qq.com> Date: Tue, 17 May 2022 16:06:11 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E6=9D=8E?= =?UTF-8?q?=E5=AE=B6=E7=8E=B2/20220510-=E9=9D=99=E5=A4=9C=E6=80=9D?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E6=88=91=E4=BB=8B=E7=BB=8D.md.txt=20?= =?UTF-8?q?=E4=B8=BA=20=E6=9D=8E=E5=AE=B6=E7=8E=B2/20220510-=E9=9D=99?= =?UTF-8?q?=E5=A4=9C=E6=80=9D=E5=92=8C=E8=87=AA=E6=88=91=E4=BB=8B=E7=BB=8D?= =?UTF-8?q?.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...45\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md.txt" => "\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md" (100%) diff --git "a/\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md.txt" "b/\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md" similarity index 100% rename from "\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md.txt" rename to "\346\235\216\345\256\266\347\216\262/20220510-\351\235\231\345\244\234\346\200\235\345\222\214\350\207\252\346\210\221\344\273\213\347\273\215.md" -- Gitee From fe5ba3d0e68958e866582de99bd299e137089d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E7=8E=B2?= <1851699117@qq.com> Date: Tue, 17 May 2022 16:06:19 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E6=9D=8E?= =?UTF-8?q?=E5=AE=B6=E7=8E=B2/20220516-=E6=95=B0=E7=BB=84=E5=92=8C?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=92=8C=E5=AD=97=E7=AC=A6=E4=B8=B2.md.md=20?= =?UTF-8?q?=E4=B8=BA=20=E6=9D=8E=E5=AE=B6=E7=8E=B2/20220516-=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E5=92=8C=E5=87=BD=E6=95=B0=E5=92=8C=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...46\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md.md" => "\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md" (100%) diff --git "a/\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md.md" "b/\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md" similarity index 100% rename from "\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md.md" rename to "\346\235\216\345\256\266\347\216\262/20220516-\346\225\260\347\273\204\345\222\214\345\207\275\346\225\260\345\222\214\345\255\227\347\254\246\344\270\262.md" -- Gitee