Saturday, February 11, 2006
this pointer Usage
#include#include using namespace std; class Buf { public: Buf( char* s ) { buffer = new char[ strlen( s ) + 1 ]; strcpy( buffer, s ); } Buf& Buf::operator=( const Buf &otherbuf ) { if( &otherbuf != this ) { delete [] buffer; buffer = new char[ strlen( otherbuf.buffer ) + 1 ]; strcpy( buffer, otherbuf.buffer ); } return *this; } void Display() { cout << buffer << endl; } private: char* buffer; }; int main() { Buf myBuf( "my buffer" ); Buf yourBuf( "your buffer" ); myBuf.Display(); myBuf = yourBuf; myBuf.Display(); }
Parallel Computing Lectures
平行計算講座,在此內容有提及如何用(&argc, &argv)的方式。
Friday, February 10, 2006
Template@C++
http://www.cplusplus.com/doc/tutorial/templates.html