On Feb 22, 10:36 pm, tselvi <[email protected]> wrote:
> Hello
> Can anyone please tell me how to implement the getAddress method with
> a return type of AddressInterface in the LAB 1027 homework excercise.
> All the setter methods in AddressInterface have primitive data type. I
> am not sure how to cast the primitive data type to AddressInterface
> type. Any help is appreciated. Please find my code for the person
> class copied below. I have coded the rest of the steps as mentiond in
> the homework exercise.
>
> public class Person extends AddressImpl implements MyOwnInterface {
>     public Person(int streetNumber, String streetName, String country)
> {
>         super(streetNumber,streetName,country);
>     }
>     //AddressInterface ai;
>
>    //AddressImpl address = new AddressImpl();
> public AddressInterface getAddress() {
>
>   return (super.getStreetNumber() + ", " + super.getStreetName() + ",
> " + super.getCountry());
>
>
>
> }
> }
You don't need to extends AddressImpl, but rather in AddressImpl write
a method which returns which returns the address (that is instead of
super use an instance of the class with the same parameters as you
did).
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to