codes/mainc-5557-1711047180.6225164.cpp: In function 'int main()':codes/mainc-5557-1711047180.6225164.cpp:40:28: error: 'class JobBid' has no member named 'getBidNumber'; did you mean 'bidNumber'? std::cout << lowestBid.getBidNumber() << std::endl; ^~~~~~~~~~~~ bidNumber
Question
codes/mainc-5557-1711047180.6225164.cpp: In function 'int main()':codes/mainc-5557-1711047180.6225164.cpp:40:28: error: 'class JobBid' has no member named 'getBidNumber'; did you mean 'bidNumber'? std::cout << lowestBid.getBidNumber() << std::endl; ^~~~~~~~~~~~ bidNumber
Solution
It seems like you're trying to access a member of the 'JobBid' class called 'getBidNumber'. However, the error message is suggesting that there is no such member in the 'JobBid' class.
Instead, it's suggesting you might have meant to use 'bidNumber'.
Here's how you can fix this:
-
Check the definition of your 'JobBid' class. Make sure that 'getBidNumber' is a member of this class. If it's not, you might need to add it.
-
If 'getBidNumber' is supposed to be a function that returns the 'bidNumber', make sure you have defined this function in your class.
-
If 'bidNumber' is a public member of 'JobBid' and you want to access it directly, you can use 'lowestBid.bidNumber' instead of 'lowestBid.getBidNumber()'.
-
If 'bidNumber' is a private member of 'JobBid', you should create a public function in the 'JobBid' class that returns 'bidNumber'. This function could be 'getBidNumber'.
Here's an example of what that might look like:
class JobBid {
private:
int bidNumber;
public:
int getBidNumber() {
return bidNumber;
}
};
In this example, 'getBidNumber' is a public function that returns the private member 'bidNumber'. You would be able to use 'lowestBid.getBidNumber()' with this setup.
Similar Questions
What will be the output of the following code?12345678910111213141516171819#include <iostream>using namespace std;class Vehicle {public: void start() { cout << "Vehicle started"; }};class Car : public Vehicle {public: void start() { cout << "Car started"; }};int main() { Car c; c.start(); return 0;}
sol.cpp: In function ‘int main()’:sol.cpp:8:83: error: ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} has no member named ‘kength’; did you mean ‘length’? 8 | cout<<one<<" "<<two<<" "<<three<<" "<<" - "<<(one.length()+two.length()+three.kength())<<endl; | ^~~~~~ | length
/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:7:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] 7 | result = (m >= 6.0 && s >= 50.5) ? "Eligible for Next Round" : (m < 6.0 || s < 50.5) ? | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const char* 8 | "Not Eligible" : "Try again..."; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What is the output of the following C++ code?#include <iostream>using namespace std;int main() { int x = 10; int y = 20; cout << (x++ + ++y) << endl; return 0;} *1 point303132Compiler error
#include <iostream>#include <string>using namespace std;class A { int a; public: A(int i) { a = i; } void assign(int i) { a = i; } int getA() { return a; }};int main() { A obj; obj.assign(5); cout << obj.getA();}
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.