Thread View: pl.comp.lang.java
3 messages
3 total messages
Started by Artur Tyloch
Tue, 05 Aug 1997 23:06
Interfejs Implementacja
Author: Artur Tyloch
Date: Tue, 05 Aug 1997 23:06
Date: Tue, 05 Aug 1997 23:06
27 lines
1016 bytes
1016 bytes
Mam klopot z implementacja interfejsu.
Wezmy prosty przyklad:
mamy interfejs:
interface PointInterface
{
void move(int dx, int dy);
}
i klase implementujaca interfejs:
class Punkt implements PointInterface
{
int x,y;
void move(int dx,int dy)
{
x=x+dx;
y=y+dy;
}
przy kompilacji w J++ mam blad:
error J0062: Attempt to reduce access level of member
'void PointInterface.move(int dx, int dy)'
Co powoduje ten blad?
Co jest nie tak?
Artur
Re: Interfejs Implementacja
Author: pki
Date: Wed, 06 Aug 1997 02:17
Date: Wed, 06 Aug 1997 02:17
42 lines
1494 bytes
1494 bytes
On Wed, 06 Aug 1997 01:06:59 +0200, Artur Tyloch
<arturt@friko.onet.pl> wrote:
>Mam klopot z implementacja interfejsu.
>Wezmy prosty przyklad:
>mamy interfejs:
>
>interface PointInterface
>{
> void move(int dx, int dy);
>}
>
>i klase implementujaca interfejs:
>
>class Punkt implements PointInterface
>{
> int x,y;
> void move(int dx,int dy)
> {
> x=x+dx;
> y=y+dy;
> }
>przy kompilacji w J++ mam blad:
> error J0062: Attempt to reduce access level of member
>'void PointInterface.move(int dx, int dy)'
>
>Co powoduje ten blad?
>Co jest nie tak?
>
>Artur
Czesc,
Istotnie tym razem M$ nic nie naklamal.
Metody w interface maja zakres dostepnosci okreslony jako publiczny.
W zwiazku z tym podczas implementacji metody w klasie Punkt rowniez
musisz okreslic zakres dostepnosci jako publiczny i wszystko bedzie OK
Pozdrawiam
Piotrek
Re: Interfejs Implementacja
Author: Artur Tyloch
Date: Wed, 06 Aug 1997 08:10
Date: Wed, 06 Aug 1997 08:10
47 lines
1647 bytes
1647 bytes
> Metody w interface maja zakres dostepnosci okreslony jako publiczny.
> W zwiazku z tym podczas implementacji metody w klasie Punkt rowniez
> musisz okreslic zakres dostepnosci jako publiczny i wszystko bedzie OK
>
> Pozdrawiam
>
> Piotrek
No tak, przeciez jest to domyslny zakres dla metod w Interfejsie :-)
Dzieki
Artur
P.S.
Zmeczony bylem wczoraj czy co? :-|
> >Mam klopot z implementacja interfejsu.
> >Wezmy prosty przyklad:
> >mamy interfejs:
> >
> >interface PointInterface
> >{
> > void move(int dx, int dy);
> >}
> >
> >i klase implementujaca interfejs:
> >
> >class Punkt implements PointInterface
> >{
> > int x,y;
> > void move(int dx,int dy)
> > {
> > x=x+dx;
> > y=y+dy;
> > }
> >przy kompilacji w J++ mam blad:
> > error J0062: Attempt to reduce access level of member
> >'void PointInterface.move(int dx, int dy)'
> >
> >Co powoduje ten blad?
> >Co jest nie tak?
> >
> >Artur
>
> Czesc,
>
> Istotnie tym razem M$ nic nie naklamal.
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads