Skip to content

Instantly share code, notes, and snippets.

@akshitzaveri
Last active May 26, 2020 18:14
Show Gist options
  • Save akshitzaveri/94cfd246c4dff2ef1340342582333482 to your computer and use it in GitHub Desktop.
Save akshitzaveri/94cfd246c4dff2ef1340342582333482 to your computer and use it in GitHub Desktop.
// Our Original class
class Example {
// Original function
class func start() {
print("Start")
}
}
// Subclassing
class ExampleSubclass: Example {
// Overriding the function
override class func start() {
super.start()
print("Overridden Start")
}
}
Example.start() // This will print "Start" in the console.
ExampleSubclass.start() // This will print "Start" and "Overridden Start" in the console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment