-
-
Save tommcfarlin/48b39d7e5524dadf0037239fef07cc7c to your computer and use it in GitHub Desktop.
[OOP Fundamentals] Two Pillars of Object-Oriented Programming: Part 2 of 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Message | |
{ | |
public function send() | |
{ | |
echo "This message is sent from the Message class.\n"; | |
} | |
public function receive() | |
{ | |
echo "This message was received from the Message class.\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SMSMessage extends Message | |
{ | |
public function send() | |
{ | |
echo "This message is sent from the SMSMessage class.\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$message = new Message(); | |
$message->send(); | |
$message->receive(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$message = new SMSMessage(); | |
$message->send(); | |
$message->receive(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Message | |
{ | |
public function send() | |
{ | |
echo "This message is sent from the Message class.\n"; | |
} | |
public function receive() | |
{ | |
echo "This message was received from the Message class.\n"; | |
} | |
} | |
class SMSMessage extends Message | |
{ | |
public function send() | |
{ | |
echo "This message is sent from the SMSMessage class.\n"; | |
} | |
} | |
$message = new Message(); | |
$message->send(); | |
$message->receive(); | |
$message = new SMSMessage(); | |
$message->send(); | |
$message->receive(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment