Content deleted Content added
Bluelinking 1 books for verifiability.) #IABot (v2.1alpha3 |
→PHP: type hinting |
||
Line 66:
=== PHP ===
<source lang=
<?php
Line 76:
class RealImage implements Image {
private string $filename = null;
/**
* Constructor
* @param $filename
*/
public function __construct(string $filename) {
$this->filename = $filename;
$this->loadImageFromDisk();
Line 105:
class ProxyImage implements Image {
private Image $image = null;
private string $filename = null;
/**
* Constructor
* @param $filename
*/
public function __construct(string $filename) {
$this->filename = $filename;
}
Line 131:
$image2 = new ProxyImage("HiRes_10MB_Photo2");
$image1->displayImage(); //
$image1->displayImage(); //
$image2->displayImage(); //
$image2->displayImage(); //
$image1->displayImage(); //
</source>
Line 145:
Displaying HiRes_10MB_Photo2
Displaying HiRes_10MB_Photo2
Displaying HiRes_10MB_Photo1
=== C# ===
|