elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  error al estar mencionar variable en kotlin
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: error al estar mencionar variable en kotlin  (Leído 2,819 veces)
EmmanuelTR9

Desconectado Desconectado

Mensajes: 31


Ver Perfil
error al estar mencionar variable en kotlin
« en: 10 Octubre 2021, 01:48 am »

Estoy practicando con kotlin pero el problema es que intento hacer un ejercicio pero no se si no entiendo lo que pide, segui instrucciones y me suelta error en una herencia a la cual le voy a escribir informacion
Código:
  

fun main(args: Array<String>){

        var transporte = moto("Trabajo","Italika",2,125,125,0)

        println(transporte.modelo)

        println(transporte.marca)

        println(transporte.numllantas)

        println(transporte.tipomotor)

        println(transporte.cilindraje)

        println(transporte.kilometraje)

    }

open class transporte(){

    //atributos

    open var modelo: String=""

    open var marca: String=""

    open var numllantas: Int = 0

    open var tipomotor: Int = 0

    open var cilindraje: Int = 0

    open var kilometraje: Int = 0

    //Atributos metodos

    var velocidad: String=""

    var acelerar: String=""

    var frenar: String=""

    //constructores

    constructor(modelo:String,marca:String,numllantas:Int,

    tipomotor:Int,cilindraje:Int,kilometraje:Int):this(){

        this.modelo = modelo    

        this.marca = marca    

        this.numllantas = numllantas    

        this.tipomotor = tipomotor    

        this.cilindraje = cilindraje    

        this.kilometraje = kilometraje    

    }

    constructor(velocidad:String,acelerar:String,

        frenar:String):this(){

        this.velocidad = velocidad    

        this.acelerar = acelerar    

        this.frenar = frenar    

}

    //Herencia

    class moto():transporte(){

        override var modelo: String=""

        override var marca: String=""

        override var numllantas: Int = 0

        override var tipomotor: Int = 0

        override var cilindraje: Int = 0

        override var kilometraje: Int = 0  

        

        constructor(modelo:String,marca:String,numllantas:Int,

    tipomotor:Int,cilindraje:Int,kilometraje:Int):this(){

        this.modelo = modelo    

        this.marca = marca    

        this.numllantas = numllantas    

        this.tipomotor = tipomotor    

        this.cilindraje = cilindraje    

        this.kilometraje = kilometraje    

    }

    }

}

Unresolved reference: moto


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines