fork download
  1. #include <iostream>
  2.  
  3. class Pop3Adaptor
  4. {
  5. private:
  6. const char* user_id;
  7. public:
  8. Pop3Adaptor() : user_id( "Initial" ){}
  9. Pop3Adaptor( const char* user_id ) : user_id( user_id ){}
  10. const char* User() const;
  11. };
  12.  
  13. const char* Pop3Adaptor::User() const
  14. {
  15. return user_id;
  16. }
  17.  
  18. int main( int argc, char* argv[] )
  19. {
  20. // With default constructor
  21. Pop3Adaptor adaptor_a;
  22. std::cout << adaptor_a.User() << std::endl;
  23.  
  24. Pop3Adaptor adaptor_b( "Foo" );
  25. std::cout << adaptor_b.User() << std::endl;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Initial
Foo