*Hey Alfredo**,

 You can try like below to access interface method by assigning object to
Address interface.


interface MyOwnInterface  extends AddressInterface {
    **AddressInterface getAddress();*
*}*
*
class AddressClass implements MyOwnInterface {*

* AddressInterface getAddress(){
 return new AddressClass();
}*

* }*

Thanks

Srinivas





On Thu, Jul 2, 2009 at 2:00 AM, Georgiana Lungu <[email protected]
> wrote:

>
> You can declare a variable of type AddressInterface but you need to
> assign it to an instance of a class that implements this interface
> (this is what is called polymorphism) let's say you have the
> AddressInterface interface, you will have a class like
>
> class AddressClass implements AddressInterface{
>  }
>
> then u can do something like this:
>
> AddressInterface anAdress=new AddressClass();
>
>
> On Jul 1, 5:09 pm, Alfredo Torres <[email protected]>
> wrote:
> > Hi,
> >
> >    I am Working now on LAB-1027 and i am having a serius and big
> > problem.
> >
> >    I Write the interface and the interface implementations classes and
> > MyOwnInterface with one method:
> >
> >    AddressInterface getAddress();
> >
> >   So far so good the problem becomes when i want to initialize the
> > adress variable.
> >
> >   AddressInterface is an interface and can not be initialized how can
> > define a variable of that?
> >
> >   Any comment that can helop me to understand all this?
> >
> > Thanks
> > Alfredo Torres
> >
> > P.D. Hope all the rest ot the homework reach its destiny
> >
>

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