Guest User

Untitled

a guest
Oct 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. class Document
  2. {
  3. protected $type;
  4.  
  5.  
  6. function __construct($type)
  7. {
  8. $this->type = $type;
  9. }
  10.  
  11. function Show()
  12. {
  13. var_dump('Я - документ Типа -' . $this->type );
  14. }
  15.  
  16. function Change()
  17.  
  18. {
  19.  
  20. }
  21.  
  22. }
  23.  
  24. $document = new Document('word');
  25. $document->Show();
  26.  
  27. class Document
  28. {
  29. protected $type;
  30. protected $string
  31.  
  32.  
  33. function __construct($type)
  34. {
  35. $this->type = $type;
  36. $this->string = 'Я - документ Типа -'.$type;
  37. }
  38.  
  39. function Show()
  40. {
  41. echo $this->string;
  42. }
  43.  
  44. function Change(string $replaceString)
  45. {
  46. $this->string = str_replace($this->type, $replaceString, $this->string);
  47. }
  48.  
  49. $document = new Document('word');
  50. $document->Show();
  51. $document->Change('excel');
  52. $document->Show();
Add Comment
Please, Sign In to add comment