-4

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 .

hakre
  • 193,403
  • 52
  • 435
  • 836
H2O
  • 39
  • 6
  • possible duplicate of [What is the difference between an interface and abstract class?](http://stackoverflow.com/questions/1913098/what-is-the-difference-between-an-interface-and-abstract-class) – JonH Apr 12 '12 at 15:21

1 Answers1

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