CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 05:40:39 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=fd8912f0f727d685017286a12101820bf3ed4b8eee4da8f3d787ab2871b882d2a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22IdCKwHtnyxTX5JxwuX2G1_hOLIZDfrpE%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d443809e21860e-BLR
Kotlin video 28 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File
- import java.io.FileWriter
- import java.io.InvalidObjectException
- import javax.management.ImmutableDescriptor
- import kotlin.random.Random
- //open class Arma(var nome: String, protected open var dannoBase: Int = 1) {
- //
- // init { require(dannoBase>=0) }
- //
- // var valore: Int = 0
- //
- // //costrutture secondario che assicura univocità del nome scelto per l'arma
- // constructor (uniqueName: String) : this(uniqueName,0)
- // {
- // //logica che verifica che nessun'altra arma sia stata chiamatata
- // //con lo stesso nome; se scopre
- // println("passato di qui")
- //
- // }
- //
- // open fun spara() {
- // println("Danno cinetico: $dannoBase")
- // }
- //}
- // Contratto per il comportamento di un'arma automatica
- interface Immagazzinabile {
- val peso: Int
- val volume: Int
- fun schedaOggetto(): MutableList<String>
- //{
- // val descrizioni: MutableList<String> = mutableListOf()
- //
- // descrizioni.add("Peso: $peso")
- // descrizioni.add("Volume: $volume")
- //
- // return descrizioni
- //}
- }
- abstract class Arma(var nome: String, protected open var dannoBase: Int = 1) : Immagazzinabile {
- init { require(dannoBase>=0) }
- abstract var valore: Int
- //costrutture secondario che assicura univocità del nome scelto per l'arma
- constructor (uniqueName: String) : this(uniqueName,0)
- {
- //logica che verifica che nessun'altra arma sia stata chiamatata
- //con lo stesso nome; se scopre
- println("passato di qui")
- }
- abstract fun spara()
- }
- class Armatura : Immagazzinabile{
- override val peso: Int = 0
- override val volume: Int = 0
- override fun schedaOggetto(): MutableList<String> {
- val descrizioni: MutableList<String> = mutableListOf()
- descrizioni.add("ARMATURA Peso: $peso")
- descrizioni.add("ARMATURA Volume: $volume")
- return descrizioni
- }
- }
- class Reliquia : Immagazzinabile{
- override val peso: Int = 0
- override val volume: Int = 0
- override fun schedaOggetto(): MutableList<String> {
- val descrizioni: MutableList<String> = mutableListOf()
- descrizioni.add("RELIQUIA Peso: $peso")
- descrizioni.add("RELIQUIA Volume: $volume")
- return descrizioni
- }
- }
- class Zaino {
- val listaOggetti: MutableList<Immagazzinabile> = mutableListOf()
- // val listaArmature: MutableList<Armatura> = mutableListOf()
- // val listaReliquie: MutableList<Reliquia> = mutableListOf()
- // //ecc. ecc.
- fun add(nuovoOggetto: Immagazzinabile) { listaOggetti.add(nuovoOggetto)}
- // fun addArmatura(nuovaArmatura: Armatura) { listaArmature.add(nuovaArmatura)}
- // fun addReliquia(nuovaReliquia: Reliquia) { listaReliquie.add(nuovaReliquia)}
- }
- class ArmaElettrica(uniqueName: String) : Arma(uniqueName) {
- override val peso: Int = 0
- override val volume: Int = 0
- override var dannoBase : Int = 2
- get() {return field;}
- set(value) {field = value}
- var livelloDannoElementale: Int = 1
- override var valore: Int = 0
- constructor(nome: String, livelloDannoElementale: Int) : this("")
- {
- require(livelloDannoElementale in 1..5)
- this.livelloDannoElementale = livelloDannoElementale
- }
- constructor() : this("", 4) {}
- fun metodoClasseFiglia() {
- //println(dannoBase)
- }
- override fun spara() {
- //super.spara() //non avrebbe senso
- println("Danno ELETTRICO: ${dannoBase+10*livelloDannoElementale}")
- }
- override fun schedaOggetto(): MutableList<String> {
- val descrizioni: MutableList<String> = mutableListOf()
- descrizioni.add("ARMA ELETTRICA Peso: $peso")
- descrizioni.add("ARMA ELETTRICA: $volume")
- return descrizioni
- }
- }
- fun main() {
- //val unArmaElettrica = ArmaElettrica()
- //println("${unArmaElettrica.nome} ${unArmaElettrica.metodoClasseFiglia()}" )
- //unArmaElettrica.spara()
- val loZaino = Zaino();
- val unArma= ArmaElettrica("boom", 5)
- loZaino.add( unArma )
- loZaino.add( Reliquia() )
- loZaino.add( Armatura() )
- for (oggetto in loZaino.listaOggetti) {
- for (rigaDescrizione in oggetto.schedaOggetto())
- println(rigaDescrizione)
- println("---------------------------------------")
- }
- //(loZaino.listaOggetti[0] as Arma).spara()
- //late binding
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 26 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch
JavaScript | 32 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ 9
JavaScript | 35 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ Y
JavaScript | 36 sec ago | 0.25 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 42 sec ago | 0.24 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 43 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ A
JavaScript | 45 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ 8
JavaScript | 52 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand