PHP Interface

An interface consists of methods that contain no implementation. In other words, all methods of the interface are abstract methods. A class can only inherit from one class whereas a class can implement one or more interfaces.All the methods in the interface must have public visibility level

<?php

interface Java{

	public function JavaCoder(); 
}

interface Php{

	public function PhpCoder(); 
}

interface Python{

	public function PythonCoder(); 
}

class Programmer implements Java,Php,Python{

	function __construct(){

		$this->JavaCoder();
		$this->PhpCoder();
		$this->PythonCoder();
	}

	function JavaCoder(){
		echo "I am a Java Coder <br/>";
	}

	function PhpCoder(){
		echo "I am a Php Coder <br/>";
	}

	function PythonCoder(){
		echo "I am a Python Coder";
	}

}

new Programmer();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s