Monday 3 March 2014

Creating class, instantiate

Public Class Person
    Private weight As Double = 8
    Private money As Double = 100
    Private income As Double = 7.25

    Public Sub eat(ByVal pounds As Double)
        weight += pounds
    End Sub

    Public Sub excercise(ByVal time As Double)
        weight -= time / 10
    End Sub

    Public Sub work(ByVal hours As Double)
        money += hours * income
    End Sub

    Public Function getweight() As Double
        Return weight
    End Function

    Public Function getmoney() As Double
        Return money
    End Function

    Public Function getincome() As Double
        Return income
    End Function
End Class

Class

Public Class Form1
Private myperson As New Person


No comments:

Post a Comment