Public Class Cubo
private lunghezza as Integer
private larghezza as Integer
private altezza as Integer
Public Property Lunghezza as Integer
Get
Return lunghezza
End Get
Set(ByVal Value as Integer)
lunghezza = Value
End Set
End Property
Public Property Larghezza as Integer
Get
Return larghezza
End Get
Set(ByVal Value as Integer)
larghezza = Value
End Set
End Property
Public Property Altezza as Integer
Get
Return altezza
End Get
Set(ByVal Value as Integer)
altezza = Value
End Set
End Property
// Metodo pubblico che visualizza il volume del cubo, usando le proprietà
// interne della classe
Public Sub visualizzaVolume()
System.Console.WriteLine("Volume: " + lunghezza * larghezza * altezza)
End Sub
End Class