From b96ac54a5ff5b3d61b0037ad0e578388695bd3a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=81=E7=B4=AB=E5=A6=8D?= <3053633754@qq.com>
Date: Tue, 17 May 2022 22:19:25 +0800
Subject: [PATCH] test
---
...2\345\220\221\345\257\271\350\261\241-.md" | 108 ++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 "\344\270\201\347\264\253\345\246\215/20220517php\351\235\242\345\220\221\345\257\271\350\261\241-.md"
diff --git "a/\344\270\201\347\264\253\345\246\215/20220517php\351\235\242\345\220\221\345\257\271\350\261\241-.md" "b/\344\270\201\347\264\253\345\246\215/20220517php\351\235\242\345\220\221\345\257\271\350\261\241-.md"
new file mode 100644
index 0000000..7d9376a
--- /dev/null
+++ "b/\344\270\201\347\264\253\345\246\215/20220517php\351\235\242\345\220\221\345\257\271\350\261\241-.md"
@@ -0,0 +1,108 @@
+```php
+price.$this->brand;
+ }
+function __construct($brand,$price)
+{ $this->brand=$brand;
+ $this->price=$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;
+ }
+function gn(){
+ echo "这辆车是".$this->brand."的,价格为:".$this->price."元";
+}
+}
+$cars =new car("超级汽车",88888);
+
+$cars->gn();
+//2、 在上例的基础上为汽车类定义一个子类——跑车类。为子类实例化对象并访问父类的属性。
+echo"
";
+class pao extends car{
+
+function __construct($brand,$price){
+ parent::__construct($brand,$price);
+
+}
+
+ function color(){
+ echo "它是黑色的";
+ }
+}
+$a=new pao("西尔贝",8888888);
+$a->color();
+$a->gn();
+echo"
";
+
+
+
+
+
+
+//3、 定义一个类,分别定义3个公共的属性和方法,3个受保护的属性和方法,3个私有属性和方法。
+class xxx
+{
+ //公共属性和方法
+public $a;
+public $b;
+public $c;
+public function a(){}
+public function b(){}
+public function c(){}
+ //受保护的属性和方法
+protected $d;
+protected $e;
+protected $f;
+protected function d(){}
+protected function e(){}
+protected function f(){}
+//私有属性和方法
+private $g;
+private $h;
+private $i;
+private function g(){}
+private function h(){}
+private function i(){}
+}
+
+```
+
--
Gitee