fork download
  1. // Ideone_Language_Id:1
  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. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2: error: expected unqualified-id before ‘public’
stdout

Standard output is empty