From: Date: July 2 2008 3:03pm Subject: Re: Derive a structure and use it with storein List-Archive: http://lists.mysql.com/plusplus/7728 Message-Id: <2b029a380807020603s1a0d383dq24babc45f47817a8@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_391_20658269.1215003839213" ------=_Part_391_20658269.1215003839213 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Warren Young, You reach the right error. Unfortunately, I've tested the tool ssqls-pretty to see what the macro produce and I saw lot of code but no constructor. I don't know if it is a good suggestion, but maybe an example in the documentation would be useful for other people. Have a nice day, many thanks. Lo=EFc 2008/7/2 Warren Young : > On Jul 2, 2008, at 3:56 AM, Lo=EFc Dardant wrote: > > class User : public database::User >> { >> public: >> User(mysqlpp::sql_varchar a, mysqlpp::sql_varchar b, mysqlpp::sql_int = c >> ); >> ~User(); >> void foo(); >> }; >> > > In C++, if a derived class has a function with the same name as one in th= e > base class, the derived class's versions always hide those in the base > class. Thus, your single ctor in the derived class hides these ctors > defined in the base SSQLS: > > User(); // default ctor, needed by STL containers > User(const mysqlpp::Row& row); // what your error is about > User(const mysqlpp::sql_varchar& a); // for-comparison ctor > > You need to define all of these in your derivative for it to be a true > SSQLS. Their implementation can be trivial: just call the base class cto= rs > of the same signature, passing along the parameters directly. > > Technically, the one ctor you do have hides a similar one in the base > SSQLS: the full-initialization ctor takes its parameters by const referen= ce, > not by value. You should redefine your one existing ctor like so: > > User(const mysqlpp::sql_varchar& a, const mysqlpp::sql_varchar& b, const > mysqlpp::sql_int& c); > > Failing to match this signature won't prevent good code from compiling, b= ut > taking the parameters by reference is more efficient in the case of > stringish data types. And if you're going to take them by reference, mak= ing > them const references is simply a matter of correctness, since you aren't > actually modifying the referents. > -- > MySQL++ Mailing List > For list archives: http://lists.mysql.com/plusplus > To unsubscribe: > http://lists.mysql.com/plusplus?unsub=3Dloic.dardant@stripped > > --=20 Lo=EFc Dardant ------=_Part_391_20658269.1215003839213--