Class property override in Java
Forums:
//in Java there are no properties
class Shape {
public int getLineCount() {
return 0;
}
}
class Square extends Shape {
public int getLineCount() {
return 4;
}
}
Square square = new Square();
//square.getLineCount() is 4
- Log in to post comments