Witam mam problem z dziedziczeniem, klasa Punkt jest klasą bazową, klasa Punkt3D jest klasą potomną, więc ma dziedziczyć po klasie Punkt.
Klasa Punkt:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dziedziczenie;
/**
*
* @author Marcin
*/
class Punkt {
int x; //pole klasy
int y; //pole klasy
//konstruktor
Punkt(int x, int y){
this.x = x;
this.y = y;
}
//metody
void setX(int x){
this.x = x;
}
void setY(int y){
this.y = y;
}
void setXY(int x, int y){
this.x = x;
this.y = y;
}
int getX(){
return x;
}
int getY(){
return y;
}
void showXY(){
System.out.println("Współrzędne puntu to: \nx = "+x
+" \ny = "+y);
}
}
Klasa Punkt3D:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dziedziczenie;
/**
*
* @author Marcin
*/
class Punkt3D extends Punkt {
int z;
}
Pytanie co jest źle?