Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created December 2, 2022 23:15
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 5AbhishekSaxena/733983fac151c5c7df0e97a70805df4d to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/733983fac151c5c7df0e97a70805df4d to your computer and use it in GitHub Desktop.
fun main() {
val message = "Happy Coding"
val notificationService = NotificationService()
var notification: Notification
notification = EmailNotification()
notificationService.notification = notification
notificationService.sendNotification(message)
// Output: Sending email notification with message "Happy Coding"
notification = SmsNotification()
notificationService.notification = notification
notificationService.sendNotification(message)
// Output: Sending sms notification with message "Happy Coding"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment