-
Notifications
You must be signed in to change notification settings - Fork 8
Se aplica las correcciones indicadas #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/vehiculos/Moto.java
Outdated
|
|
||
| public class Moto extends VehiculoConRuedas { | ||
|
|
||
| public String getMatricula() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No se ha pedido matrícula para las motos
src/vehiculos/Moto.java
Outdated
| public class Moto extends VehiculoConRuedas { | ||
|
|
||
| public String getMatricula() { | ||
| return super.matricula; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si pones el campo privado no tendrías acceso a él
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lo puse como protected para poder acceder a ese campo desde el hijo. ¿No se debería?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lo hice asi, para poder implementar un método abstracto.
src/vehiculos/Moto.java
Outdated
| public Moto(String modelo, String color, String matricula) { | ||
| super(modelo, color, 2, matricula); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem comentario de matrícula
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En este caso se manda la matricula al contranstuctor vehículo con ruedas,, que es publico, aunque matricula fuera privado, entiendo que no daría problemas, no?
src/vehiculos/VehiculoConRuedas.java
Outdated
| private String matricula; | ||
| private int cantRuedas; | ||
| private Date fechaMatriculacion; | ||
| protected String matricula; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No se ha pedido matricula aquí
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como era código que se repetía entre los hijos, lo incluí en el padre, lo quitaré.
src/vehiculos/VehiculoConRuedas.java
Outdated
| private int cantidadRuedas; | ||
|
|
||
| public abstract Date proximaItv(); | ||
| public abstract String getMatricula(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como comenté era solo por poner un método abstracto. Se podría hacer como método normal, así lo haré.
|
Se suprime la matricula de Moto. |
Se aplican los cambios indicados a VehiculoConRuedas, y se añade Moto.