Hi,

I am not sure this is the right way to do the workwork, please advise.

1.  To implement MyOwnInterfac, I will need to create a reference
variable <address> of AddressImpl type in Person class, so i can use
it in the constructor and implement the getAddress method

    // Constructor with arguments
    Person(int cashSaving,
            int retirementFund,
            String firstName,
            String lastName,
            AddressImpl address) {
        this.cashSaving = cashSaving;
        this.retirementFund = retirementFund;
        this.firstName = firstName;
        this.lastName = lastName;
        this.address = address;
    }

    public AddressInterface getAddress() {
        return address;
    }



2. I will also need to create a reference variable <address> of
AddressImpl type  in order to create object instance of Person class

        AddressImpl address = new AddressImpl("Malaysia", "Jalan
Ismail", 30);
        Person person1 = new Person(10000, 20000, "Sang", "Shin",
address);

Regards
KC

-- 
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to