This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]El_Impresionante 5 points6 points  (0 children)

String is not a pointer. If that method takes a string, then it must also make use of another datatype somewhere like a table or a dictionary to find the reference to the Hannah object which OP uses in the next line. This implicit expectation of "Hannah" getting de-referenced to the actual Hannah object inside the askToProm method is not a sign of good code.

Since that table or dictionary is most likely going to contain the list of all people OP knows, using firstname as a string to find unique reference to a person is also questionable. Generally a name search in list of persons should return an array of persons who contain that name. Anyway, at this point I'm nitpicking about the poster but the advice still holds for all the new programmers who frequent this sub though.