From 890fd0d3ed29b65ce97fc755466517bf43808adc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=B4=E5=90=AF=E6=98=8C?= <3110587048@qq.com>
Date: Tue, 17 May 2022 19:43:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...73\344\270\216\345\257\271\350\261\241.md" | 147 ++++++++++++++++++
1 file changed, 147 insertions(+)
create mode 100644 "\345\220\264\345\220\257\346\230\214/20220517-PHP\347\261\273\344\270\216\345\257\271\350\261\241.md"
diff --git "a/\345\220\264\345\220\257\346\230\214/20220517-PHP\347\261\273\344\270\216\345\257\271\350\261\241.md" "b/\345\220\264\345\220\257\346\230\214/20220517-PHP\347\261\273\344\270\216\345\257\271\350\261\241.md"
new file mode 100644
index 0000000..80a5c6b
--- /dev/null
+++ "b/\345\220\264\345\220\257\346\230\214/20220517-PHP\347\261\273\344\270\216\345\257\271\350\261\241.md"
@@ -0,0 +1,147 @@
+# 解答
+
+``` php
+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;
+ }
+
+}
+$cars=new car("车名:"."法拉利 ","车的价格:"."500万元");
+echo $cars->getBrand().$cars->getPrice();
+
+//echo $a;
+//2、 在上例的基础上为汽车类定义一个子类——跑车类。为子类实例化对象并访问父类的属性。
+class bus extends car{
+ private $color;//颜色
+ private $speed;// 速度
+
+ function __construct($brand, $price,$color,$speed)
+ {
+ $this->color = $color;
+ $this->speed = $speed;
+ parent::__construct($brand, $price);
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * @param mixed $color
+ */
+ public function setColor($color)
+ {
+ $this->color = $color;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSpeed()
+ {
+ return $this->speed;
+ }
+
+ /**
+ * @param mixed $speed
+ */
+ public function setSpeed($speed)
+ {
+ $this->speed = $speed;
+ }
+}
+
+echo "