Suppose I have a class like this: it has a name
and surname
as attributes and a single function that msgboxes the data. Should I use the first variant of this function or the second?
Private name As String
Private surname As String
Function do_something_1() As String
MsgBox("Hello, " & name & " " & surname)
do_something_1 = name & " " & surname
End Function
Function do_something_2(name As String, surname As String) As String
MsgBox("Hello, " & name & " " & surname)
do_something_2 = name & " " & surname
End Function
And in case of the second function, would the name
and surname
arguments overload the class attributes? Say if the class attributes are John
and Green
, while the function is called with Jack
and Black
which would be msgboxed?
EDIT: I'm aware that in the first version the attributes can also be accessed through getters, but I prefer not to use it here.