PHP Classes

File: PublicWrap.demo.php

Recommend this page to a friend!
  Classes of Ninsuo   PHP Public Wrap   PublicWrap.demo.php   Download  
File: PublicWrap.demo.php
Role: Example script
Content type: text/plain
Description: Demo: a full usage example
Class: PHP Public Wrap
Access an object private variables and functions
Author: By
Last change:
Date: 11 years ago
Size: 1,038 bytes
 

Contents

Class file image Download
<?php

require("PublicWrap.php");

/**
 * Usage example of the public wrapper.
 */

class Something
{
    public
$a = "a...\n";
    protected
$b = "b...\n";
    private
$c = "c...\n";

    static public
$d = "d...\n";
    static protected
$e = "e...\n";
    static private
$f = "f...\n";

    public function
g() { return "g...\n"; }
    protected function
h() { return "h...\n"; }
    private function
i() { return "i...\n"; }

    static public function
j() { return "j...\n"; }
    static protected function
k() { return "k...\n"; }
    static private function
l() { return "l...\n"; }
}

$something = new Something();
$demo = new PublicWrap($something);

echo
$demo->a;
echo
$demo->b;
echo
$demo->c;
echo
$demo->d;
echo
$demo->e;
echo
$demo->f;

echo
$demo->g();
echo
$demo->h();
echo
$demo->i();
echo
$demo->j();
echo
$demo->k();
echo
$demo->l();

/*
alain@beast:/home/ninsuo/PublicWrap$ php PublicWrap.demo.php
a...
b...
c...
d...
e...
f...
g...
h...
i...
j...
k...
l...
 */