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

Info icon This 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)
Image of page 1

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

View Full Document Right 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 New class can inherit properties & methods form existing class
Image of page 2
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 they’re 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 they’re 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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern