Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
クラスがあるとします
class MyClass(a: Int, b: String) { //.... }
このコンストラクターにカスタム ロジック (コード) を追加したい場合、どうすればよいですか?
class MyClass(a: Int, b: String) { // this is the constructor right here println("Hi, i'm the constructor") def imAMethod = 1 println("Hi, I'm also part of the constructor down here, the whole class body is") }