I have this CSVParser class, I inherited it, and I need to call <<
operator in my derived class:
#include "dbcsv.h"
DbCsv::DbCsv() : CSVParser()
{
}
void addColumn(QString &source, const QString &val, const unsigned int s) // 0:duplicate, 1:unique
{
CSVParser::<< source.toStdString();
}
void removeColumn(QString &source, const QString &val)
{
}
I get this error:
dbcsv.cpp: In function 'void addColumn(QString&, const QString&, unsigned int)':
dbcsv.cpp:10: error: expected unqualified-id before '<<' token
dbcsv.cpp: At global scope:
Precede <<
with operator
and append parentheses. to make operator<<(whatever)
.
This works for the other bit shift operator, and other operator overloads.
CSVParser::operator<<(source.toStdString());
The parentheses are mandatory, this is a function call.
Of course, if you haven't overridden operator<<
, then it's simpler:
*this << source.toStdString(); // probably what you want
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.