What's up all. .net is here so i guess i will attempt to make the transition :rolleyes: :p I haven't programmed in Visual Basic in awhile so im looking for code that is equivalent to Java. For instance i want to implement getters/setters in Visual Basic.
In Java i would just do somthing like.......
Now in Visual Basic .net i see that bolth are lumped in one property like the following.Code:public class Guage{
static private double temp;
static private double dewpoint;
public void setTemp(double temp){
this.temp = temp;
}
public double getTemp(){
return temp;
}
public void setDewpoint(double dewpoint){
this.dewpoint = dewpoint;
}
public double getDewpoint(){
return dewpoint;
}
public static void main(String[] args){
Guage g = new Guage();
System.out.println(" Temp is " + g.getTemp() + " Dewpoint is " + g.getDewpoint());
g.setTemp(56.7);
g.setDewpoint(76.6);
System.out.println(" Temp is " + g.getTemp() + " Dewpoint is " + g.getDewpoint());
}
}
Is this the proper way to use code getters/setters in Visual Basic?Code:Dim strName as String
Property Name() as String
Get
Name = strName
End Get
Set(byVal sName as String)
strName = Value
End Set
End Property
And i thought that Visual Basic was true OOP? So i there a way to refrence the object in which the current method is being called? It seems stupid to define this method with a return type of String when say if the value is just being set then we don't want anything returned. That's the way it was in VB6. As in the following.
Code:Dim strName as String
Property Get Name() as String
Name = strName
End Property
Property Let Name(strNameIn as String)
strName = strNameIn
End Property
