4 ms·
There's nothing special about this. I've written numerous classes in C++/C# that return a single object to the creator but instantiate or swap between different
by ajg1977 16y ago
There's nothing special about this. I've written numerous classes in C++/C# that return a single object to the creator but instantiate or swap between different impl classes based on usage patterns.
- rchowe 16y agoWhat I'm saying is that you can't do something like this in C++-derived OO languages class Test { Test( int count ) { if ( count > 5000 ) return new Implementation(); return new OtherImplementation(); } } you'd have to use a class method, whereas you can do that with the standard alloc/init in Objective-C.