search
Homephp教程php手册PHP演示抽象类一个示例源码

PHP演示抽象类一个示例源码

Jun 06, 2016 pm 07:38 PM
abstractphpcontentabstractDemodetailed

无详细内容 无 ?php/* * abstract */ /* * 抽象类: * 1、至少有一个抽象方法(没有具体实现的方法) * 2、不能被实例化,可以被继承 * 3、抽象类可以有子抽象类 * 相对于接口: * 1、可以有属性 * 2、一个子类只能继承一个抽象类,但是可以实现多个接口 * *

<?php
/*
 * abstract
 */
 
 /*
  * 抽象类:
  * 1、至少有一个抽象方法(没有具体实现的方法)
  * 2、不能被实例化,可以被继承
  * 3、抽象类可以有子抽象类
  * 相对于接口:
  * 1、可以有属性
  * 2、一个子类只能继承一个抽象类,但是可以实现多个接口
  * 
  * 
  * */
 abstract class qian {
 	abstract function getfirst();
 	function gettwo() {
 		echo "I am gettwo";
 	}
 }
 
 abstract class jj extends qian {
 	abstract function getthree();
 }
 
 
 class nan extends jj {
 	function getfirst() {
 		echo "I am getfirst";
 	}
 	
 	function getthree() {
 		echo "I am getthree";
 	}
 }
 
 $nn = new nan();
 
 $nn->getfirst();
 $nn->gettwo();
 $nn->getthree();
 
 ?>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment