Ereditarietà e overriding in Swift
Oggi vediamo un semplice esempio di ereditarietà e overriding in Swift.
Partiamo subito dalla classe base:
class Veicolo {
var numeroRuote: Int;
var tipoCarburante: String;
func desc() -> String {
return "Numero ruote: \(numeroRuote); Tipo carburante \(tipoCarburante)";
}
init() {
numeroRuote = 0;
tipoCarburante = "";
}
}