3

Are all this Kotlin snippets equivalent?

open class A
// A() - explicit call of A default constructor
class B : A()

using super() :

open class A

class B : A {
    constructor() : super()
}

using super :

open class A

class B : A {
    constructor() : super
}

nothing is specified:

open class A

class B : A {
    constructor()
}

So, what is a difference between super and super() in this cases, and if i understand right - last snippet implicitly calls super()?

1 Answer 1

1

What is a difference between super and super() in this cases

Nothing, both are the same

Last snippet implicity calls super()

Yes, it does.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, as a result - all snippets are the same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.