Is it possible to pass a class as a parameter to a function? I currently have a base class that I call BaseClass . Right now, here is what I can do:
func someFunction(instanceParameter: BaseClass) {
The parameter will be some class that inherits from BaseClass . However, I would like to pass the class type as a parameter. Here are a few pseudo codes:
func someFunction(classParameter: Class) {
The parameter will be ClassThatInheritsFromBaseClass instead of an instance of ClassThatInheritsFromBaseClass .
Also, is it possible to limit the class parameter to classes that inherit from BaseClass ? The pseudo code below shows what I mean.
func someFunction(classParameter: BaseClass_Class_Not_Instance) {
source share