Created
October 18, 2024 20:10
-
-
Save zehan12/9a1670a0a4b4443029b2876dbd36bfef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Notification { | |
| send(message) { | |
| console.log(`Sending notification: ${message}`); | |
| } | |
| } | |
| class EmailNotification extends Notification { | |
| send(message) { | |
| console.log(`Sending email: ${message}`); | |
| } | |
| } | |
| class PushNotification extends Notification { | |
| sendWithToken(message, token) { | |
| console.log(`Sending push notification with token ${token}: ${message}`); | |
| } | |
| } | |
| const email = new EmailNotification(); | |
| email.send("Hello!"); // Sending email: Hello! | |
| const push = new PushNotification(); | |
| push.sendWithToken("Hello!", "12345"); // Sending push notification with token 12345: Hello! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment