Last active
May 26, 2020 18:14
-
-
Save akshitzaveri/94cfd246c4dff2ef1340342582333482 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
// 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