PHP中的数据抽象

数据抽象是任何OOPS编程语言中最重要的功能。它仅显示有用的信息, 其余信息对最终用户是隐藏的。抽象是实现细节被隐藏(抽象)的数据的任何表示形式。

例子1

<?php
abstract class Animal
{
public $name;
public $age;
public function Describe()
{
return $this->name . ", " . $this->age . " years old";    
    	}
abstract public function Greet();
}
class cat extends Animal
{
public function Greet()
{
return "Lion!";    
}
public function Describe()
{
return parent::Describe() . ", and I'm a cat!";    
}
}
$animal = new cat();
$animal->name = "Seru";
$animal->age = 5;
echo $animal->Describe();
echo $animal->Greet();

?>

输出

PHP中的数据抽象

来源:

https://www.srcmini02.com/29273.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37979.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?