//Child class
class DialogPermission(myContext : Context) : BaseDialog(myContext) {
private var mBtnPermission: Button? = null
private var mOnClickListener: DialogInterface.OnClickListener? = null
override fun setWidthScale(): Float {
return 0.9f
}
// parent class
abstract class BaseDialog(protected var context: Context) :
Dialog(context, R.style.DialogTransparent) {...
// error of parent class
Accidental override: The following declarations have the same JVM signature (getContext()Landroid/content/Context;):
public final fun `<get-context>`(): Context? defined in com.applock.lock.widget.BaseDialog
public final fun getContext(): Context defined in com.applock.lock.widget.BaseDialog
// error of child class in kotlin
Inherited platform declarations clash: The following declarations have the same JVM signature (getContext()Landroid/content/Context;): fun `<get-context>`(): Context? defined in com.applock.lock.widget.DialogPermission fun getContext(): Context defined in com.applock.lock.widget.DialogPermission
Since the method
getContext()is final in theDialogclass, then you cannot override it in subclasses (BaseDialogin your case).To figure this out, you can for instance define
BaseDialogas: