[Php-it] Metodi comuni e non tra classi della stessa interfaccia
Gianluca Baù
gianluca at ihuri.it
Thu Mar 1 16:52:01 CET 2007
> On 01/mar/07, at 16:42, Gianluca Baù wrote:
>
>> Se non si può fare con le interfacce, esiste un altro metodo?
>
>
> IL metodo è la semplice derivazione! :)
>
> Cris
>
?!?!? Non ho capito scusa
Cmq penso che la soluzione sia questa,
Abstract Classes
An abstract class is a class that is only partially implemented by the
programmer. It may contain one or more abstract methods. An abstract
method is simply a function definition that serves to tell the
programmer that the method must be implemented in a child class.
To create an abstract class we use the code shown in Listing 1:
*Listing 1: An Abstract PHP class*
<?php
abstract class Weapon
{
private $SerialNumber;
abstract public function fire();
public function __construct($SerialNumber)
{
$this->SerialNumber = $SerialNumber;
}
public function getSerialNumber()
{
return $this->SerialNumber;
}
}
?>
Condividi ??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ziobudda.net/pipermail/php-it/attachments/20070301/c1aa280d/attachment.html
More information about the Php-it
mailing list