Interface question ??

A

Antonio Santiago

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.



--
 
R

Remon van Vliet

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top