I have created a class named employee with its members id,name,salary.I have few questions in this whose answer i am not confident .Please check it and tell me the answers
here are the questions
Q 1 ) what will be its default constructor?
ans:
Sub New()
End Sub
Q 2 ) write an overloaded constructor that passes the employees name and salary?
ans:
Sub New(ByVal name1 As String, ByVal salary1 As Decimal)
name = name1
salary = salary1
End Sub
Q 3 ) write getter and setter method for salary
ans:
Property salary1() As Decimal
Get
salary1 = salary
End Get
Set(ByVal value As Decimal)
salary = value
End Set
End Property
Q 4 ) write a getter only for the id?
ans:
ReadOnly Property id1() As Decimal
Get
id1 = id
End Get
Q 5 ) create a list of employees.
i don't know its answer.
Q 6 ) add a new employee to the list using default constructor
i don't know its answer.
Q 7) Add a new employee to the list using overloaded constructor
ans:
Private emp As Employee
emp = New Employee(txtid.Text, txtname.Text, txtsalary.Text)
txtid,txtname,txtsalary are textboxes on form
Q 8 ) write the code that would loop through employee list and output their salary
I don't know its answer
Q 9 ) what function should be called first if overloading a form's constructor?
I don't know its answer
please see to it and provide me relevant answers
thanx
regards