fork(3) download
  1. #include <iostream>
  2.  
  3. struct A { friend std::ostream& operator << (std::ostream& o, const A& c) { return o; }; };
  4. struct B { friend std::ostream& operator << (std::ostream& o, const B& c) { return o; }; };
  5.  
  6. int main(int argc, char** argv)
  7. {
  8.  
  9. A *arrayA = new A[10];
  10. B *arrayB = new B[10];
  11.  
  12. /* some codes to initialize arrayA and arrayB */
  13. for (int i = 0; i < 10; i++) { std::cout << arrayA[i]; } // this work
  14. for (int j = 0; j < 10; j++) { std::cout << arrayB[j]; } // this complain
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 2852KB
stdin
Standard input is empty
stdout

Standard output is empty