Skip to content

Instantly share code, notes, and snippets.

@DanielHe4rt
Created May 6, 2021 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielHe4rt/d4284ad7f049ee2dbb8196ed239e056c to your computer and use it in GitHub Desktop.
Save DanielHe4rt/d4284ad7f049ee2dbb8196ed239e056c to your computer and use it in GitHub Desktop.
Ensinando OO a base do fodase Rev 123123123
<?php
class Fodase {
public static function vaiCaralho() {
echo "vai caralho";
}
}
Fodase::vaiCaralho();
class Chatter extends Fodase
{
public $name;
private $messagesCount = 0;
private $lastSeen;
public function __construct(string $name) {
$this->name = $name;
$this->vaiCaralho();
}
public function sendMessage(string $message)
{
$this->messagesCount++;
echo "[". date('Y-m-d') ."]" . $this->name . ": " . $message . PHP_EOL;
}
public function getMessagesCount() {
return $this->messagesCount . PHP_EOL;
}
}
$danielhe4rt = new Chatter('danielhe4rt');
$buuh = new Chatter('buh');
$danielhe4rt->sendMessage('vai toma no cu nessa porra odeio programa');
$buuh->sendMessage('PO TO ENTENDENDO SEPA ESPERO Q ESTEJA');
$buuh->sendMessage('PO TO ENTENDENDO SEPA ESPERO Q ESTEJA');
$buuh->sendMessage('PO TO ENTENDENDO SEPA ESPERO Q ESTEJA');
$buuh->sendMessage('PO TO ENTENDENDO SEPA ESPERO Q ESTEJA');
echo $buuh->getMessagesCount();
$buuh->vaiCaralho();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment