To the first question, No. Do not assume AddressImpl address; gets
used in Person class.
Person should use private AddressInterface address; in the variables
list and

// Implement MyOwnInterface method
    public AddressInterface getAddress() {
        return address;
    }

This needs to be public here because you will use it in Main.class.
And there you will store address data using the AddressImpl.class.
An instance of AddressInterface.class holds the address data. I know
it seems confusing that an interface with no variables is able to
store anything but that is the magic of using interface instances. It
is still a class and we gave whatever holds the address data that
classification.

from Main.class

AddressInterface address1 = person1.getAddress();// data = get method

On Sep 4, 2:21 pm, miga <[EMAIL PROTECTED]> wrote:
> On Sep 4, 8:54 pm, abstract26 <[EMAIL PROTECTED]> wrote:
>
> > Is it okay to assume that the Person class will contain the
> > AddressImpl class instance?


> You don't need this line, otherwise you defeat the purpose of the
> AddressInterface interface.
>
> >        AddressImpl address;
>
> This, yes, that's the implementation of MyOwnInterface, except that it
> should be public.> // The person class contains a method
>
> >   AddressInterface getAddress(){
> >    }
>
> > }
>
> > The addressImpl class implements the AddressInterface
> > where as the
> > Person class implements MyOwnInterface.
>
> See above.

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