1

I have this code.

class VBO (size: Int, usage: Int,
    private val vao: Int = GL30.glGenVertexArray(), 
    private val vbo: Int = GL15.glGenBuffers())

Why can I use size and usage in other methods in the class? Also what are they considered (fields, methods, ect.)?

1 Answer 1

4

They are usable because, presumably, you need them for some reason, seeing as you declared them as parameters. They are effectively private val if you use them on def or lazy val. If you do not use them at all, or only to initialize val or var, they exist only in the constructor, and are not part of the instances created.

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

Comments

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.