Uso de this para acceder a constructores de objetos
Cuando un queremos
llamar a un constructor desde otro constructor, usaremos this:
private double ancho, alto; Elipse(double alto, double ancho) { this.alto= alto; this.ancho= ancho; } // construye un
círculo Elipse(double
diametro) { this(diametro,
diametro); } // construye un
círculo de diámetro 10 Elipse() { this(10); } |
Temas relacionados