From: Warren Young Date: July 2 2008 12:01pm Subject: Re: Derive a structure and use it with storein List-Archive: http://lists.mysql.com/plusplus/7727 Message-Id: <3EE0F2CE-BD46-474D-858B-5E3A60C8F842@etr-usa.com> MIME-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable 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, =20 > mysqlpp::sql_int c > ); > ~User(); > void foo(); > }; In C++, if a derived class has a function with the same name as one in =20= the base class, the derived class's versions always hide those in the =20= base class. Thus, your single ctor in the derived class hides these =20 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 =20= SSQLS. Their implementation can be trivial: just call the base class =20= ctors of the same signature, passing along the parameters directly. Technically, the one ctor you do have hides a similar one in the base =20= SSQLS: the full-initialization ctor takes its parameters by const =20 reference, not by value. You should redefine your one existing ctor =20 like so: User(const mysqlpp::sql_varchar& a, const mysqlpp::sql_varchar& b, =20 const mysqlpp::sql_int& c); Failing to match this signature won't prevent good code from =20 compiling, but taking the parameters by reference is more efficient in =20= the case of stringish data types. And if you're going to take them by =20= reference, making them const references is simply a matter of =20 correctness, since you aren't actually modifying the referents.=