fork download
  1. class Base { public: int x; };
  2. class Derived : public Base { public: int y; };
  3.  
  4. void init(Base *b)
  5. {
  6. for(int i = 0; i < 3; ++i)
  7. {
  8. b[i].x = 0;
  9. }
  10. }
  11. void example11(void)
  12. {
  13. Derived arr[3];
  14. init(arr);
  15. }
  16. /* package whatever; // don't place package name! */
  17.  
  18. import java.util.*;
  19. import java.lang.*;
  20. import java.io.*;
  21.  
  22. /* Name of the class has to be "Main" only if the class is public. */
  23. class Ideone
  24. {
  25. public static void main (String[] args) throws java.lang.Exception
  26. {
  27. // your code goes here
  28. }
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:18:1: error: ‘import’ does not name a type
 import java.util.*;
 ^
prog.cpp:19:1: error: ‘import’ does not name a type
 import java.lang.*;
 ^
prog.cpp:20:1: error: ‘import’ does not name a type
 import java.io.*;
 ^
prog.cpp:25:9: error: expected ‘:’ before ‘static’
  public static void main (String[] args) throws java.lang.Exception
         ^
prog.cpp:25:27: error: ‘String’ has not been declared
  public static void main (String[] args) throws java.lang.Exception
                           ^
prog.cpp:25:36: error: expected ‘,’ or ‘...’ before ‘args’
  public static void main (String[] args) throws java.lang.Exception
                                    ^
prog.cpp:25:40: error: expected ‘;’ at end of member declaration
  public static void main (String[] args) throws java.lang.Exception
                                        ^
prog.cpp:25:42: error: ‘throws’ does not name a type
  public static void main (String[] args) throws java.lang.Exception
                                          ^
prog.cpp:29:1: error: expected ‘;’ after class definition
 }
 ^
stdout
Standard output is empty