fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. const char cstr[] = "abcd" ;
  6. const void* p = cstr ;
  7.  
  8. std::cout << cstr ;
  9. // overload resolves to: free function which prints a c-style string
  10. // std::ostream& operator<< ( std::ostream&, const char* ) ;
  11. std::operator<< ( std::cout, cstr ) ;
  12.  
  13. std::cout << p ;
  14. // overload resolves to: member function which prints the value of a pointer
  15. // std::ostream::operator<< ( const void* ) ;
  16. std::cout.operator<< (p) ;
  17.  
  18. }
  19.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
abcdabcd0xbfe60c2b0xbfe60c2b