fork download
  1. # Ideone_Language_Id:4
  2. public class Car {
  3. public void toString() {
  4. print "I am a Car!"
  5. }
  6. }
  7. public class Ferrari extends Car {
  8. public void toString() {
  9. print "I am a Ferrari!"
  10. }
  11. }
  12. public class Indica extends Car {
  13. public void toString() {
  14. print "I am a Indica!"
  15. }
  16. }
  17. main(){
  18. Ferrari f= new Ferrari();
  19. Car c(f);
  20. Car* c2 = &f;
  21. c2->toString();
  22. c.toString();
  23. }
Runtime error #stdin #stdout 0.08s 10864KB
stdin
Standard input is empty
stdout

Standard output is empty