Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CLASS: OVERLOADING
- class vehicles {
- // SET PROPERTIES
- var name: String? = null
- var wheels: String? = null
- var wing: Int? = null
- var color: String? = null
- constructor()
- // Constructor
- constructor(name: String, wheels: String, wing: Int, color: String) : this() {
- this.name = name
- this.wheels = wheels
- this.wing = wing
- this.color = color
- println("OBJECT, Name: " + this.name + " wheels: " + this.wheels + " wing: " + this.wing + " color: " + this.color)
- }
- constructor(name: String, wheels: String, color: String) : this() {
- this.name = name
- this.color = color
- this.wheels = wheels
- println("OBJECT, Name: " + this.name + " wheels: " + this.wheels + " color: " + this.color)
- }
- constructor(name: String, color: String, wing: Int) : this() {
- this.name = name
- this.color = color
- this.wing = wing
- println("OBJECT, name: " + this.name + " wing: " + this.wing + " color: " + this.color)
- }
- constructor(name: String, color: String) : this() {
- this.name = name
- this.color = color
- println("OBJECT, Name: " + this.name + " color: " + this.color)
- }
- }
- fun main() {
- var jet = vehicles("jet", "3", 2, "dark blue")
- var truck = vehicles("truck", "8", "yellow")
- var bike = vehicles("bike", "black")
- var plane = vehicles("plane", "black", 6)
- var rocket = vehicles("rocket", "white", 2)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement