Greeting !! i wnt to know more about abstact class and Interface . and terminology to inhereted like abstract class extends and interface implements.need a help .please solve my problem.provide some example with matter .
Asked
Active
Viewed 89 times
1 Answers
0
An abstract class is a class which is NOT instantiated, so there is no such thing like this:
<?php
$p = new person();
?>
The abstract class can only be inherited and not used directly. You use it as a base class where you put all the code that other classes can share.
An interface is like an agreement which methodes a class must implement:
// Declare the interface 'iExample'
interface iExample
{
// methodes
}
// Implement the interface
// This will work
class Thingy implements iExample
{
// implement the methodes specifies in the interface
}

Roger
- 1,004
- 2
- 12
- 24