VB NOTES PART 15

VB NOTES PART 15 - Parent (super) and child (sub) classes...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
3/24 Public property Second () As Integer Get Return SecondVal End get Set (ByVal value As Integer) If value < 60 AndAlso value >=0 Then SecondVal =value Else SecondVal =0 End if End set End property …..outside example…… ReadOnly Property BA () As Double ReadOnly Property don’t have set Get Return Hits/ AtBats End Get End Property 5. Methods (Want to write a method add one minute to the timer) Public Sub Addoneminute () Minute +=1 End Sub ……elsewhere in code…. . Dim myTime As Time = New Time (4, 31) MyTime. Addoneminute () myobject.method MyTime. Minute = 12 3/29 Overloading New Public Sub New (ByVal mm As Integer, ByVal ss As Integer)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Minute=mm Second=ss End Sub Public Sub New (ByVal mm As Integer) Minute=mm Second=0 End Sub Public Sub New (ByVal ss As Integer) Public Sub New (ByVal something As double) ----------- is ok because of different parameters ---Inheritance
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Parent (super) and child (sub) classes Student Staff University person Gender First Name First Name Age Last name Last name University ID Courses Street First name University ID City Last name Degrees Age Major Zip Gender Street Office Zip City Street University ID Zip code City Phone number Hire date GPA Age University Person Student staff (have more unique properties) TA TA Public Class Student Inherits University Person---Polymorphism Objects can have different behavior based on how theyre defined Employee Compute pay -Salary hour-compute pay Tip Earner- compute pay Remember: Object is an instance of a class Objects exist as long as theyre in scope Public Sub mySub () Dim time1 As Time= New Time (10, 20) reference variables Dim time2 As Time= New Time (30, 30) Time1= time2-----------------change time1 to time2...
View Full Document

Page1 / 3

VB NOTES PART 15 - Parent (super) and child (sub) classes...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online