Avatar ·

What is the difference between static func and class func in Swift?

Hi! I started learning Swift and came across two similar ways to declare methods: `static func` and `class func`. It seems like both allow calling a method at the type level rather than on an instance, but I don't understand the fundamental difference. For example, I can write: ```swift class MyClass { static func staticMethod() { print("This is a static method") } class func classMethod() { print("This is a class method") } } ``` And call them the same way: `MyClass.staticMethod()` and `MyClass.classMethod()`. The result is the same – strings are printed. So why are there two different keywords? I tried creating a subclass and overriding the method, but the compiler complains when I try to override `static func`. And `class func` seems to allow overriding.