fork(46) download
  1. #include <iostream>
  2.  
  3. namespace C{
  4. void Hello(){
  5. std::cout<<"Hello"<<std::endl;
  6. }
  7. extern "C" void HelloThere(){
  8. std::cout<<"Hello There from extern \"C\""<<std::endl;
  9. }
  10. }
  11.  
  12. extern "C" void HelloThere();
  13.  
  14. int main() {
  15. C::Hello();
  16. C::HelloThere(); //Compiles
  17. //Hello(); <--- does not compile
  18. HelloThere(); //Also compiles and ptints the same as C::HelloThere() !!!
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Hello
Hello There from extern "C"
Hello There from extern "C"