Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about classes 1

Status
Not open for further replies.

Edge118

Programmer
Jun 15, 2004
104
US
I have my code for my Alarm class below. My one method is called isEqual and is used to compare two alarm objects. I call it by saying object1.isEqual(object2).

What I want to know is, when I'm in the mehtod, how do I refer to the object that called it? In C++, "this" is used, but I'm not sure about VB. Thanks for your help.

Code:
Public Day As String
Public Hour As String
Public Minute As String
Public isEnabled As Boolean
Public amPM As String

Public Function isEqual(alarmTwo As Alarm) As Boolean

End Function

"Pin me. Perl me."

Regards,

Chris
 
Inside an instance of the class?

Did you try Me ?
 
Or you can just refer to the variable name directly, e.g.
Code:
If alarmTwo.Day = Day Then ...
Either way will work.
 
Are you aware that Day, Hour and Minute are Visual basic keywords?



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Me is correct, but as in C++, unqualidied invocations, implicitly refer to the instance called for. However I'ts counterproductive to program in VB as if it were C++. The Is operator returns True if two references refer to the same instance and False otherwise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top