hey guys/gals im havin a problem in my test.cpp file in line 65 where i have cout << date.print();

the compiler says:
test.cpp: In member function âvoid Test::print() constâ:
test.cpp:67: error: no match for âoperator<<â in âstd::cout << ((const Test*)this)->Test::date.Date::print()â

where am i making a mistake because i have <iostream> and using namespace std; where i need it? any suggestions?

Recommended Answers

All 2 Replies

In order to print something using a cout statement your function must return something (a string, int, double, etc). Your print() method is void. Just call your print method on its own without sending it into cout.

In order to print something using a cout statement your function must return something (a string, int, double, etc). Your print() method is void. Just call your print method on its own without sending it into cout.

ok thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.