Tangara G

Tangara G

  • 1.7k
  • 298
  • 63k

How do I call another class with its fields ?

Aug 6 2020 4:22 AM
I have a class named Target with fields like name, dob with the gettter and setter and a public class with constructors.
Now, I need another class to call Target fields.
So I put something like this :
public bool upload(Assessment assessment, Database database, Target target){
database = new ClauseService(settings);
assessment = database.GetTargetAssessment(target); // I awnt to know if this is valid because actually what I want is to bring in the field of Target like target.name, or target.getName() etc here in the parameters but I am not sure how to do it.
Furthermore, I'd like to know if Target class should exist at all but the fields in Target class is actually used in several classes.
I hope someone can advise me. Thanks.

Brought to you by:

Answers (3)