Re: Connection::connect() interface is changing
Warren Young wrote:
> class Connection ... { > public: > class TCP { > public: > TCP(host, user, port, etc...); > } > Connection(const TCP& tcp); > > #ifdef MYSQLPP_PLATFORM_WINDOWS > class NamedPipes { > public: > NamedPipes(); > } > Connection(const NamedPipes& np); > #else > class DomainSockets { > public: > DomainSockets(path); > } > Connection(const DomainSockets& ds); > #endif > }
I'm a dunce. The solution is staring me right in the face: inheritance!
This is a perfect is-a relationship. Just make one lightweight
subclass of Connection for each connection style. Then, depending on
how we're feeling about code compatibility, we can either retain the
candy machine ctor in the parent class, or make Connection's ctor
private and make the subclasses call mysql_real_connect() themselves.
--
MySQL++ Mailing List
For list archives:
http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=lists@pantek.com
Received on Sat Jul 14 00:48:27 2007
This archive was generated by hypermail 2.1.8
: Thu Aug 02 2007 - 01:56:49 EDT
|