-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.php
More file actions
executable file
·36 lines (24 loc) · 1010 Bytes
/
interfaces.php
File metadata and controls
executable file
·36 lines (24 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
//An interface is a blueprint that defines a set of methods that a class must implement.
//It specifies a contract for classes, outlining the methods they must have without specifying the actual implementation.
interface City { // this is perent interface
function test($var);
}
interface Product { // this is perent class
}
class phone implements City, Product{ // phone is child class & implements get a parent interface & define multiple interface but that not used abstract method
function test($var)
{
return 'Lorem Ipsum '.$var;
}
}
class phone_call implements City, Product{ // phone_call is child class & implements get a parent interface but that not used abstract method
function test($var)
{
return 'Lorem Ipsum '.$var;
}
}
$obj =new phone();
echo $obj->test('Helloo');
//NOTE: abstract method and interface method getting deffrent define a public function with body and access in child class in abstract method and print your properties but interface not supported
?>