hacker


Ingresar con nombre de usuario, contraseña y duración de la sesión
| Portal Hacker | Editorial | Descargas | Ezine |
Inicio Ayuda Ingresar Registrarse
25 de Julio de 2008, 09:35:34
Noticias: Te consideras bueno en C++?
Para ver este enlace Registrate o Inicia Sesion
Aquí

+  Foros pOrtal Hacker
|-+  Programacion
| |-+  Programación en general
| | |-+  Visual Basic
| | | |-+  Codigo Abierto
| | | | |-+  Clases CAsignatura
0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: Clases CAsignatura  (Leído 169 veces)
Grado_0
Recien llegado
*
Desconectado Desconectado

Mensajes: 10



Ver Perfil
« : 26 de Mayo de 2007, 10:19:50 »

CLASE CASIGNATURA
Option Explicit

Private m_Nombre As String
Private m_Nota As Single
Private m_Fecha As Date

Public Event Error(ByVal Código As Integer, Cancelar As Boolean)


Property Let Nombre(Nom As String)
  Dim Cancelar As Boolean
  If Nom = "" Then
    RaiseEvent Error(2001, Cancelar)
  End If
  If Cancelar Then Exit Property
  m_Nombre = Nom
End Property

Property Get Nombre() As String
  Nombre = m_Nombre
End Property

Property Let Nota(N As Single)
  Dim Cancelar As Boolean
  If N < 0 Or N > 10 Then
    RaiseEvent Error(2002, Cancelar)
  End If
  If Cancelar Then Exit Property
  m_Nota = N
End Property

Property Get Nota() As Single
  Nota = m_Nota
End Property

Property Let Fecha(F As Date)
   m_Fecha = F
End Property

Property Get Fecha() As Date
  Fecha = m_Fecha
End Property


Private Sub Class_Initiali ze()
 
  m_Nombre = ""
  m_Nota = 0
  m_Fecha = Now
  Debug.Print "Objeto " & m_Nota & " " & m_Fecha & " construido"
End Sub


Private Sub Class_Terminat e()
 
  Debug.Print "Objeto " & m_Nota & " " & m_Fecha & " destruido"
End Sub
CcolAlumno
Option Explicit


Private m_Col As Collection

Public Function Add(Nombre As String, Optional sClave As String) As CAlumno
  On Error GoTo TratamientoErr or
 
  Dim objNuevo As CAlumno
  Set objNuevo = New CAlumno

 
  objNuevo.Nombr e = Nombre
  If Len(sClave) = 0 Then
    m_Col.Add objNuevo, Nombre
  Else
    m_Col.Add objNuevo, sClave
  End If
   
 
  Set Add = objNuevo
  Set objNuevo = Nothing
  Exit Function
TratamientoErr or:
  MsgBox Err.Descriptio n
End Function

Public Sub Remove(vntIndClave As Variant)
 
  m_Col.Remove vntIndClave
End Sub

Public Property Get Item(vntIndClave As Variant) As CAlumno
 
  Set Item = m_Col(vntIndClave)
End Property

Public Property Get Count() As Long
 
  Count = m_Col.Count
End Property

Public Property Get NewEnum() As IUnknown
 
  Set NewEnum = m_Col.[_NewEnum]
End Property

Private Sub Class_Initiali ze()
 
  Set m_Col = New Collection
End Sub

Private Sub Class_Terminat e()
 
  Set m_Col = Nothing
End Sub

CcolEdificios

Option Explicit


Private m_Col As Collection

Public Function Add(Nombre As String, Optional sClave As String) As CEdificio
  On Error GoTo TratamientoErr or
 
  Dim objNuevo As CEdificio
  Set objNuevo = New CEdificio

 
  objNuevo.Nombr e = Nombre
  If Len(sClave) = 0 Then
    m_Col.Add objNuevo, Nombre
  Else
    m_Col.Add objNuevo, sClave
  End If
   
 
  Set Add = objNuevo
  Set objNuevo = Nothing
  Exit Function
TratamientoErr or:
  MsgBox Err.Descriptio n
End Function

Public Sub Remove(vntIndClave As Variant)
 
  m_Col.Remove vntIndClave
End Sub

Public Property Get Item(vntIndClave As Variant) As CEdificio
 
  Set Item = m_Col(vntIndClave)
End Property

Public Property Get Count() As Long
 
  Count = m_Col.Count
End Property

Public Property Get NewEnum() As IUnknown
 
  Set NewEnum = m_Col.[_NewEnum]
End Property

Private Sub Class_Initiali ze()
 
  Set m_Col = New Collection
End Sub

Private Sub Class_Terminat e()
 
  Set m_Col = Nothing
End Sub


CEdificio

Option Explicit


Private m_colAulas As CcolAulas
Private m_Nombre As String

Public Property Get colAulas() As CcolAulas
 
  Set colAulas = m_colAulas
End Property

Public Property Let Nombre(ByVal vData As String)
 
  m_Nombre = vData
End Property

Public Property Get Nombre() As String
 
  Nombre = m_Nombre
End Property

Private Sub Class_Initiali ze()
 
  Set m_colAulas = New CcolAulas
End Sub

Private Sub Class_Terminat e()
 
  Set m_colAulas = Nothing
End Sub

CcolAula

Option Explicit


Private m_Col As Collection

Public Function Add(Nombre As String, Optional sClave As String) As CAula
  On Error GoTo TratamientoErr or
 
  Dim objNuevo As CAula
  Set objNuevo = New CAula
 
 
  objNuevo.Nombr e = Nombre
  If Len(sClave) = 0 Then
    m_Col.Add objNuevo, Nombre
  Else
    m_Col.Add objNuevo, sClave
  End If
 
 
  Set Add = objNuevo
  Set objNuevo = Nothing
  Exit Function
TratamientoErr or:
  MsgBox Err.Descriptio n
End Function

Public Sub Remove(vntIndClave As Variant)
 
  m_Col.Remove vntIndClave
End Sub

Public Property Get Item(vntIndClave As Variant) As CAula
 
  Set Item = m_Col(vntIndClave)
End Property

Public Property Get Count() As Long
 
  Count = m_Col.Count
End Property

Public Property Get NewEnum() As IUnknown
 
  Set NewEnum = m_Col.[_NewEnum]
End Property

Private Sub Class_Initiali ze()
 
  Set m_Col = New Collection
End Sub

Private Sub Class_Terminat e()
 
  Set m_Col = Nothing
End Sub

CcolProfesores

Option Explicit


Private m_Col As Collection

Public Function Add(Nombre As String, Asignatura As String, Optional sClave As String) As CProfesor
  On Error GoTo TratamientoErr or
 
  Dim objNuevo As CProfesor
  Set objNuevo = New CProfesor

 
  objNuevo.Nombr e = Nombre
  objNuevo.Asign atura = Asignatura
  If Len(sClave) = 0 Then
    m_Col.Add objNuevo, Nombre
  Else
    m_Col.Add objNuevo, sClave
  End If
   
 
  Set Add = objNuevo
  Set objNuevo = Nothing
  Exit Function
TratamientoErr or:
  MsgBox Err.Descriptio n
End Function

Public Sub Remove(vntIndClave As Variant)
 
  m_Col.Remove vntIndClave
End Sub

Public Property Get Item(vntIndClave As Variant) As CProfesor
 
  Set Item = m_Col(vntIndClave)
End Property

Public Property Get Count() As Long
 
  Count = m_Col.Count
End Property

Public Property Get NewEnum() As IUnknown
 
  Set NewEnum = m_Col.[_NewEnum]
End Property

Private Sub Class_Initiali ze()
 
  Set m_Col = New Collection
End Sub

Private Sub Class_Terminat e()
 
  Set m_Col = Nothing
End Sub

« Última modificación: 26 de Mayo de 2007, 10:51:55 por Grado_0 » En línea

<< LA LIBRE INFORMACIÓN ES LA LIBRE EXPRECIÓN>>
Páginas: [1] Ir Arriba Imprimir 
« anterior próximo »
Ir a:  


Ingresar con nombre de usuario, contraseña y duración de la sesión

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC hacker

Juegos gratis - Articulos PHP - Juegos - Trucos - Letras - Juegos - Juegos Online