In Objective-C, we have this thing called "method swizzling", where we can basically redefine a method without creating a subclass. This ability is most helpful when we are dealing with an object that doesn't let us define a subclass for a given object. Suppose, for example, that we have two classes that are provided to us by Apple. Calling a method of class A gives us an object of class B. Class B has a method called "method", and we want something more/different to happen when "method" is called. In that case, we can "swizzle" the method.
I can see from my C++ programing book that there is no way to do such a thing in C++; any overriding is to happen from a derived class. Makes me wonder, though: Is there a workaround?
I can see from my C++ programing book that there is no way to do such a thing in C++; any overriding is to happen from a derived class. Makes me wonder, though: Is there a workaround?