Q&A Discussions
can someone please explain why this code keeps telling me complication error instead of outputting the value of speed.
#include <iostream>
using namespace std;
class myClass {
public:
void setcarspeed (int a){
speed=a;
}
int getcarspeed(){
return speed;
}
private:
int speed;
};
int main() {
myClass obj;
obj.setcarspeed (40);
cout<<obj.getcarspeed ;
return 0;
}
2 Votes
3 AnswersQuestion about "return"
0 Votes
1 AnswerReturn in c++
0 Votes
1 AnswerWhy the 0 in return 0?
1 Vote
1 Answermultiple values return
4 Votes
5 AnswersWhat is return 0;
0 Votes
6 AnswersWhy we use return 0;?
0 Votes
3 AnswersReturn type
0 Votes
6 AnswersHow can i retun a 2d array?
0 Votes
7 Answersreturn a vector
0 Votes
3 AnswersHot today
C++ Vectors
0 Votes
Active learner
0 Votes
Code challenge
0 Votes
A Little Question Here!
1 Votes