I have two class is a call Autos
and another Utilitarios
. When I go to look for a vehicle for its registration in Autos
and that registration belongs to a Utilitario
I skip error in the code below. How can I, instead of having an error, I throw a message saying that this vehicle belongs to the class Utilitario
.
else {
Console.WriteLine(((Utilitarios)v).MostrarPolimorfico());
Console.WriteLine("\n" + "¿Que desea hacer?");
Console.WriteLine("\n" + "1- EDITAR INFORMACION");
Console.WriteLine("2- BORRAR VEHICULO");