Multiple constructor in the base class and call the most suitable one in the derived class in Kotlin
I have a base class with two constructors, which accepts errorMessage and errorCode. errorMessage is mandatory but errorCode is not.
class FooBaseClass{
constructor(errorMessage: String) // 1. Constructor
constructor(errorMessage: String, errorCode: Int) // 2. Constructor
}
and a derived class with primary constructor
class FooDerivedClass(errorMessage: String, errorCode: Int) :
FooBaseClass(errorMessage, errorCode)
I want to design the constructor of my derived...