By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,413 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,413 IT Pros & Developers. It's quick & easy.

do I need to specify an = operator for this

P: n/a

class A
{
struct DATA
{
std::vector<std::string> descriptions, units;
std::vector<double> values;
std::string type, name;
} elalin;
}

Do I need to explicitly write an = operator for 'A' and/or for 'DATA'
?
The operator should call the '=' operator for each member.

Thank you,

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Gernot Frisch wrote:

class A
{
struct DATA
{
std::vector<std::string> descriptions, units;
std::vector<double> values;
std::string type, name;
} elalin;
}
;
Do I need to explicitly write an = operator for 'A' and/or for 'DATA'
?
No.
The operator should call the '=' operator for each member.


Yes, it should.

Jul 23 '05 #2

P: n/a
Gernot Frisch wrote:

class A
{
struct DATA
{
std::vector<std::string> descriptions, units;
std::vector<double> values;
std::string type, name;
} elalin;
}

Do I need to explicitly write an = operator for 'A' and/or for 'DATA'
?
The operator should call the '=' operator for each member.


If this is all your op= needs to do, then no, yo udon't need
to write one yourself. The compiler generated one will do
exactly that:
call op= for the base classes (if they exists)
call op= for all members
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.