Can void return a value?
can void return a value? and does string getCourseName and return courseName do different things or they do the samething?
example:
string getCourseName()
{
return courseName;
}
void displayMessage()
{
cout << "Hello" << getCourseName();
}
Other Answers:
void does not return anything. You can use "return;" in displayMessage() to exit that method, but that's all it will do.
getCourseName() is the method that returns a string variable called courseName
getCourseName() is the method that returns a string variable called courseName
0 коммент.:
Post a Comment