I'll be upfront this is for an online class assignment and I cannot wait around for short replies from the instructor anymore. I feel that I've got a good amount of the coding completed. The instructions are to write an application that determines the area of a circle and a square, and include the use of classes and constructors. And for the record, I haven't had a C++ class in 8 years so I'm beyond rusty.
I am receiving this error when I debug the program and cannot figure out what "no match for 'operator>>'in" means for this specific situation even after an hour of google time:
squareClass.cpp|17|error: no match for 'operator>>' in '(& std::operator<< <std::char_traits<char> >((* & std::cout), ((const char*)"Enter the Width of the Square ")))->std::basic_ostream<_CharT, _Traits>::operator<< <char, std::char_traits<char> >(((const void*)std::cin.std::basic_istream<char>::<anonymous>.std::basic_ios<_CharT, _Traits>::operator void*<char, std::char_traits<char> >())) >> ((squareClass*)this)->squareClass::Length'|
So far I have started with a base class (shapeClass), and a derived class (squareClass) and wanted to get these working correctly before I start on the circleClass. Any help would be greatly appreciated.
Square Class .cpp: 16 cout << "Enter the Width of the Square " <<
Not sure if this just didn't get cut and pasted into the forum post, but this line has an extra << at the end and no semicolon. Did you mean to put in an endl; like you do on line 14?
Lines 14, 18: These lines don't do anything. They do calculate the area, but you don't do anything with the returned result.
Line 17: You call the squareClass default constructor which does not initialize members Width and Length. When you call getArea(), you're going to be calculating based on garbage in Width and Length.
Line 12: You pass width and length in as arguments by value. The statements at lines 19 and 20 don't do anything. You're changing the arguments, but the effect is lost.