牛 坤 wrote:
> #define MAX 20
>
> class Connect
> {
> private:
> char host[ MAX ];
A transplant to C++ from C, I see. Consider using string here instead.
Fixed-length character arrays are *so* 1990...
> Connect( char host[] = NULL, char user[] = NULL, char password[] =
> NULL )
It's more accepted in C++ to use 0 instead of NULL.
> this -> host = host;
It's extremely rare to ever need to use the 'this' pointer. You
certainly don't need to use it to access member variables. In this
particular instance, you need it because you've named some parameters
the same as some class members, but you can avoid even this use of the
'this' pointer by using C++ initializer lists:
Connect(char* host = 0, char* user = 0, char* password = 0) :
host(host),
user(user),
password(password)
{
....
> I can always see exception thrown out of libmysqlpp.so
It's covered in the FAQ:
http://tangentsoft.net/mysql++/#faq