c++ compile error when initializating an object
<p>Am new to c++ and need help in resolving an error.
The code below compiles fine on older Sun versions (CC 5.3 and 5.8). 
I put a comment at line where error is occuring.
Any assistance would be greatly appreciated.
Thanks so much.
-RW</p>

<p>Unix version: SunOS ut51278 5.10 Generic_141444-09 sun4u sparc SUNW,SPARC-Enterprise<br>
Compiler version: CC: Sun C++ 5.11 SunOS_sparc 2010/08/13 </p>

<p>database.h:</p>

<pre><code>#include &lt;dbserver.h&gt; 
#include &lt;dbstoredproc.h&gt; 
#include "dbsql.h" 

class Database : public DBServer 
{ 
        public : 
                DBSql SQL( const char* sqlCmd ); 
                DBSql SQL( const std::string&amp; sqlCmd ); 
                DBSql Table( const char* tableName );                         
                DBSql Table( const std::string&amp; tableName ); 
                DBStoredProc storedProc( const char* spName ); 
                DBStoredProc storedProc( const std::string&amp; tableName ); 
}; 
</code></pre>

<p>dbsql.h:</p>

<pre><code> #include &lt;string&gt; 
#include "dbaccess.h" 
#include "dbtable.h" 

class DBSql : public DBAccess 
{ 
public: 
        DBSql(DBServer *pServer,const char *sql) ; 
        DBSql(DBServer *pServer,const std::string&amp; sql); 
        DBSql(DBSql&amp; dbSql); 
        DBSql&amp; operator=(DBSql&amp; dbSql); 
        virtual DBTable getResultSet(); 
protected: 
        DBSql(); 
        void init(DBServer *pServer,const std::string&amp; sql); 

}; 
</code></pre>

<p>Error is occuring in database.cpp... see comment with error message....</p>

<p>database.cpp:</p>

<pre><code>#include &lt;database.h&gt; 
#include "dbsql.h" 
using namespace std; 

DBSql Database::Table( const char* tableName ) 
{ 
     return Table( string( tableName ) );  // Error: "Cannot use DBSql to initialize DBSql."
} 
DBSql Database::Table( const string&amp; tableName ) 
{ 
      string sqlCmd = "select * from " + tableName; 
      return SQL( sqlCmd.c_str() );   

} 
DBSql Database::SQL( const char* sqlCmd ) 
{ 
      return DBSql(this,sqlCmd);           
} 
DBSql Database::SQL( const string&amp; sqlCmd ) 
{ 
      return SQL( sqlCmd.c_str() );        
} 
DBStoredProc Database::storedProc( const char* spName ) 
{ 
     return DBStoredProc( this, spName ); 
} 
DBStoredProc Database::storedProc( const std::string&amp; spName ) 
{ 
    return DBStoredProc( this, spName ); 
} 
</code></pre>

<p>dbsql.cpp:</p>

<pre><code>#include "dbsql.h" 
#include "dbcommon.h" 
using namespace std; 
using namespace ORACLE; 

DBSql::DBSql(DBServer *pServer,const char* sql) 
{ 
   init(pServer,string(sql)); 
} 
DBSql::DBSql(DBServer *pServer,const string&amp; sql) 
{ 
   init(pServer,sql); 
} 
DBSql::DBSql(DBSql&amp; dbSql) 
 : DBAccess(dbSql) 
{ 

} 
DBSql&amp; DBSql::operator=(DBSql&amp; dbSql) 
{ 
  DBAccess::assign(dbSql); 
  return *this; 
} 
DBSql::DBSql() 
{ 
} 
void DBSql::init(DBServer *pServer,const string&amp; sql) 
{ 
   execSQL(pServer,sql.c_str()); 
} 

DBTable DBSql::getResultSet() 
{ 
DBTable result; 
  if(DBAccess::getResultSet(false)) 
  { 
  //In order to prevent DBAccess from closing the previous result set, pass false to 
  //getResultSet 
    result = DBTable(m_pStmt,m_pResultSet,true); // Pass true to DBTable to allow it       
    m_pStmt = NULL;                              //  to control the statement. 
  } 
  m_pResultSet = NULL; 
  return result; 
} 
</code></pre>
