I hope I can explain this... I'm in my first semester of Java courses, so I'm still pretty new at this.
This is what I'm trying to do, if there's a better way to do it please let me know:
I have created a class named Contact. Within the Contact class are fields String contactName, Address contactAddress, String contactTelephone, and String contactEmail.
I also have a class named Address. The Address class contains the String fields streetAddress, city, and postalCode.
The contactAddress within Contact uses the data type Address, as shown above.
I have mutator methods within Address, for each field.
I have a mutator method within Contact that accepts an Address variable:
I would like to overload this, and create a mutator method that accepts three Strings, for the streetAddress, city, and postalCode.
This is what I'm trying to add within the Contact class, but it's not working:
I can't seem to access the public method setAddress (from the Address class) from within a method in the Contact class. Is this possible?
Or how else might I be able to accomplish this?
This is what I'm trying to do, if there's a better way to do it please let me know:
I have created a class named Contact. Within the Contact class are fields String contactName, Address contactAddress, String contactTelephone, and String contactEmail.
I also have a class named Address. The Address class contains the String fields streetAddress, city, and postalCode.
The contactAddress within Contact uses the data type Address, as shown above.
I have mutator methods within Address, for each field.
I have a mutator method within Contact that accepts an Address variable:
I would like to overload this, and create a mutator method that accepts three Strings, for the streetAddress, city, and postalCode.
This is what I'm trying to add within the Contact class, but it's not working:
I can't seem to access the public method setAddress (from the Address class) from within a method in the Contact class. Is this possible?
Or how else might I be able to accomplish this?