|
-
May 17th, 2004, 10:40 AM
#1
Thread Starter
Frenzied Member
custom classes [RESOLVED]
When you create your own class and you create your methods, it's better to reference the property instead of the variable when making changes to those. (this was from another thread).
if you use the keyword ME.{property}..... will that cause problems later? or does it have to be ClassName.{property}?
Last edited by Andy; Aug 13th, 2004 at 12:11 PM.
-
May 17th, 2004, 11:12 AM
#2
PowerPoster
Hi,
As I understand it, Me.PropertyName is OK and must be used where there is a variable and a field with the same name (which can be easily avoided). A problem arises if you override the member in the derived class, so you must not make it overridable.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 17th, 2004, 11:57 AM
#3
Frenzied Member
Me will always refer to the Class the property is located in.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
May 17th, 2004, 12:25 PM
#4
Personaly I've always used the variable name, then there is no confusion as where the data is comming from/going to. Whether it's best practice or not, I don't know.
TG
-
May 17th, 2004, 01:21 PM
#5
I usually go for the properties. That way, if I add any type of logic into the Property Set, I don't need to worry about differing results in other areas of the class.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|