18.01.2013 Views

Programación en Visual Basic 2008

Programación en Visual Basic 2008

Programación en Visual Basic 2008

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

derivada que se hereda de Persons, a la que se agregan las nuevas<br />

propiedades.<br />

Inténtelo<br />

Para crear una clase derivada<br />

Abra el proyecto Persons que creó <strong>en</strong> la lección anterior. Si no lo guardó,<br />

regrese a Probar una clase y finalice los procedimi<strong>en</strong>tos.<br />

En el Explorador de soluciones, seleccione el nodo del proyecto Persons.<br />

En el m<strong>en</strong>ú Proyecto, elija Agregar clase.<br />

En el cuadro de diálogo Agregar nuevo elem<strong>en</strong>to, escriba Players <strong>en</strong> el<br />

cuadro Nombre, a continuación, haga clic <strong>en</strong> Agregar.<br />

Se agregará un nuevo módulo de clase al proyecto.<br />

En el Editor de código, agregue lo sigui<strong>en</strong>te justo debajo de la línea Public<br />

Class Players.<br />

<strong>Visual</strong> <strong>Basic</strong> Express Copiar código<br />

Inherits Persons<br />

Agregue el sigui<strong>en</strong>te código para definir dos nuevas propiedades.<br />

<strong>Visual</strong> <strong>Basic</strong> Express Copiar código<br />

Private numberValue As Integer<br />

Private positionValue As String<br />

Public Property Number() As Integer<br />

Get<br />

Number = numberValue<br />

End Get<br />

Set(ByVal value As Integer)<br />

numberValue = value<br />

End Set<br />

End Property<br />

Public Property Position() As String<br />

Get<br />

Everts Garay | Granada, Nicaragua| Paseo por <strong>Visual</strong> <strong>Basic</strong> <strong>2008</strong> 128

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!