Correct code

Report a typo

A class Base is defined as follows:

open class Base(val num: Int, var isZero: Int = 0, val str: String = "Europe") {
    constructor(num: Int, str: String) : this(num, 0, str)
}

Find the correct code snippets for defining a class Derived.

a)

class Derived : Base {
    constructor(num: Int, isZero: Int, str: String) : super(num, isZero, str)
    constructor(num: Int, str: String) : super(num, str)
}

b)

class Derived : Base() {
    constructor(num: Int, isZero: Int, str: String) : super(num, isZero, str)
    constructor(num: Int, str: String) : super(num, str)
}

c)

class Derived : Base {
    constructor(val num: Int, var isZero: Int, val str: String) : super(num, isZero, str)
    constructor(num: Int, str: String) : super(num, str)
}

d)

class Derived : Base {
    constructor(num: Int) : super(num)
    constructor(num: Int, str: String) : super(num, str)
}
Select one or more options from the list
___

Create a free account to access the full topic