1 #include <iostream> 2 #include <string> 3 #include </path/to/header.h> 4 #include <header.h> 5 #include "myhead.hh" 6 7 class MyClass { 8 public: MyClass()9 MyClass() { 10 std::cout << "con\\str'u'ctor" << std::endl; 11 } ~MyClass()12 virtual ~MyClass() { 13 std::cout << "\"destructor\"" << std::endl; 14 } 15 16 void print(); 17 18 private: 19 std::string myname; 20 21 }; 22 23 /* 24 Multi line comment, with embedded strange characters: < > &, 25 email address: testuser@example.com and even an URL: 26 http://www.example.com/index.html and a file name and a path: 27 <example.cpp> and </usr/local/example.cpp>, 28 example2.cpp and /usr/local/example2.cpp. 29 Ending with an email address: username@example.com 30 */ 31 32 // C++ also supports single line comments print()33void MyClass::print() { 34 char c = ''''; 35 int i = 123; 36 std::cout << myname.c_str() << std::endl; 37 } 38