Creating Objects in programming is one the best ways to have code that is easily maintainable. With new Classic ASP clients, I have found creating Classes and Objects is a very good way to begin refactoring legacy code.

Class trip

    public arrive_date
    public depart_date

End Class

Here we have created a Class trip with 2 properties arrive_date and depart_date. Now, when we need to access the arrival date, you can access the values as

myobject.arrive_date
myobject.depart_date

Before we can access or use the trip Class, we need to create a new instance of a class. The newly instantiated trip Class, which is now an object with the properties, that we can use.

 

Class trip

    public arrive_date
    public depart_date

End Class



dim objTrip
set objTrip = new trip

objTrip.arrive_date = '02/11/2017'
objTrip.depart_date = '02/16/2017'

Now that we have created a new instance of our trip and assigned values to each property, we can write some simple HTML to retrieve the values

<p>

I will be arriving on <%=objTrip .arrive_date%> and leaving on <%=objTrip .depart_date%>

<p>

 

If you are a looking for Classic ASP Experts or upgrading to .NET from Classic ASP , give us a call.