Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Document
- {
- protected $type;
- function __construct($type)
- {
- $this->type = $type;
- }
- function Show()
- {
- var_dump('Я - документ Типа -' . $this->type );
- }
- function Change()
- {
- }
- }
- $document = new Document('word');
- $document->Show();
- class Document
- {
- protected $type;
- protected $string
- function __construct($type)
- {
- $this->type = $type;
- $this->string = 'Я - документ Типа -'.$type;
- }
- function Show()
- {
- echo $this->string;
- }
- function Change(string $replaceString)
- {
- $this->string = str_replace($this->type, $replaceString, $this->string);
- }
- $document = new Document('word');
- $document->Show();
- $document->Change('excel');
- $document->Show();
Add Comment
Please, Sign In to add comment