In the following code, I create a base abstract class Base. I want all the classes that inherit from Base to provide the name property, so I made this...
I’d like to test an abstract class. Sure, I can manually write a mock that inherits from the class. Can I do this using a mocking framework (I’m using...
Why is it possible to write constructor for an abstract class in C#? As far as I know we can’t instantiate an abstract class.. so what is it for?...
Because I am used to the old ways of duck typing in Python, I fail to understand the need for ABC (abstract base classes). The help is good on...
What is an “abstract class” in Java? 14 Answers 14
Please explain when I should use a PHP interface and when I should use an abstract class? How I can change my abstract class in to an interface? 11...
How can I make a class or method abstract in Python? I tried redefining __new__() like so: class F: def __new__(cls): raise Exception("Unable to create an instance of abstract...
This may be a generic OOP question. I wanted to do a generic comparison between an interface and an abstract class on the basis of their usage. When would...
I was wondering how to unit test abstract classes, and classes that extend abstract classes. Should I test the abstract class by extending it, stubbing out the abstract methods,...
I’m originally a Java programmer who now works with Objective-C. I’d like to create an abstract class, but that doesn’t appear to be possible in Objective-C. Is this possible?...