Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Gambas class file
- Inherits Componente
- Private ListaDeComponentes As New Componente[] 'pueden ser Empleados como Departamentos (Hoja o Compuesto)
- Private hNombreDepartamento As String
- Public Sub _new(nombre As String)
- hNombreDepartamento = nombre
- End
- Public Function getNombre() As String
- Return hNombreDepartamento
- End
- Public Function getSueldo() As Single
- Dim sumador As Single = 0
- Dim i As Integer
- For i = 0 To ListaDeComponentes.Max
- sumador += ListaDeComponentes[i].getSueldo()
- Next
- Return sumador
- End
- Public Sub agrega(p As Componente) ' puedo agregar tanto Departamentos como Empleados
- ListaDeComponentes.Add(p)
- End
- Public Sub borrar(nombre As String)
- Dim i As Integer
- For i = 0 To ListaDeComponentes.Max
- If ListaDeComponentes[i].getNombre() = nombre Then
- ListaDeComponentes.Delete(i)
- Return 'retorno porque ya lo he borrado
- Endif
- Next
- End
- Public Function getEstructuraDepartamento() As String
- Return hNombreDepartamento
- End
- Public Sub setNombreDepartamento(NombreDepartamento As String)
- hNombreDepartamento = NombreDepartamento
- End
- Public Function getEstructura(cadenainicial As String) As String
- Dim cadena As String
- Dim i As Integer
- For i = 0 To ListaDeComponentes.Max
- cadena &= ListaDeComponentes[i].getEstructura(cadenainicial & getEstructuraDepartamento() & "-> ") & "\n"
- Next
- Return cadena
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement