Interface question ??

Discussion in 'Java' started by Antonio Santiago, Jun 16, 2005.

  1. Hi group. I think this is an stupid question and it can be resolve with
    a couple of lines of code but just now it is impossible to me test it.

    The question is: I have a clase A that implements a method "m" of the
    interface I. Can I modify attributes of class A into the implementation
    of "m" ??

    I think yes, but I'm creating a plugins for an existent program
    (PoseidonUML) and code into the implementation of an interface method
    doesn't modify the class attributes. It is very strage, no?

    Thanks in advice,
    Antonio.



    --
    -----------------------------------------------------
    Antonio Santiago Pérez
    ( email: santiago<<at>>grahi.upc.edu )
    ( www: http://www.grahi.upc.edu/santiago )
    ( www: http://asantiago.blogsite.org )
    -----------------------------------------------------
    GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
    Universitat Politècnica de Catalunya
    -----------------------------------------------------
    Antonio Santiago, Jun 16, 2005
    #1
    1. Advertising

  2. If i read your explanation correctly (which was a bit of a challenge) then
    yes :

    interface I {

    public void m();
    }

    class A implements I {

    public int v;

    public void m() {

    v = 0xff;
    }
    }

    I dont see how there being an interface is relevant for this example though,
    but then it is entirely possible i didnt understand your question properly.

    Remon van Vliet

    "Antonio Santiago" <> wrote in message
    news:d8rng4$ebs$...
    > Hi group. I think this is an stupid question and it can be resolve with
    > a couple of lines of code but just now it is impossible to me test it.
    >
    > The question is: I have a clase A that implements a method "m" of the
    > interface I. Can I modify attributes of class A into the implementation
    > of "m" ??
    >
    > I think yes, but I'm creating a plugins for an existent program
    > (PoseidonUML) and code into the implementation of an interface method
    > doesn't modify the class attributes. It is very strage, no?
    >
    > Thanks in advice,
    > Antonio.
    >
    >
    >
    > --
    > -----------------------------------------------------
    > Antonio Santiago Pérez
    > ( email: santiago<<at>>grahi.upc.edu )
    > ( www: http://www.grahi.upc.edu/santiago )
    > ( www: http://asantiago.blogsite.org )
    > -----------------------------------------------------
    > GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
    > Universitat Politècnica de Catalunya
    > -----------------------------------------------------
    Remon van Vliet, Jun 16, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wildepiet
    Replies:
    0
    Views:
    1,849
    Wildepiet
    Jun 14, 2004
  2. cyberco
    Replies:
    8
    Views:
    480
    cyberco
    Feb 25, 2006
  3. Xah Lee
    Replies:
    15
    Views:
    573
    Sherm Pendley
    Mar 23, 2007
  4. Xah Lee
    Replies:
    15
    Views:
    620
    Sherm Pendley
    Mar 23, 2007
  5. Replies:
    4
    Views:
    336
    timjowers
    Nov 2, 2007
Loading...

Share This Page