abstract class ServerMock(param: String) {
protected var someVar = params + "123"
fun justMyVar() = someVar
}
Usage example:
class BaseServer(param: String) : ServerMock(param) {
val y = someVar
}
Can this class be marked as open
and not abstract
?
What is the difference between open
and abstract
class?
abstract
class cannot be instantiated and must be inherited, abstract classes are open
for extending by default. open
modifier on the class allows inheriting it. If the class has not open
modifier it is considered final and cannot be inherited.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With