C++ simple program errors in declaring variables
Hey, i tried to write a simple C++ porgram about classes but i have some problems...take a look at my code:
Code:
#include <iostream>
using namespace std;
class Data{
private:
int height;
int age;
char name;
public:
int printAll();
};
void Data::printAll(info.height){
cout << "info.height: " << info.height << "\n";
}
int main(void){
Data info;
cout << "Height:";
cin >> info.height;
info.printAll(info.height);
return 0;
}
output errors:
Code:
class_program.cpp:14: error: variable or field ‘printAll’ declared void
class_program.cpp:14: error: ‘info’ was not declared in this scope
class_program.cpp: In function ‘int main()’:
class_program.cpp:7: error: ‘int Data::height’ is private
class_program.cpp:21: error: within this context
class_program.cpp:7: error: ‘int Data::height’ is private
class_program.cpp:22: error: within this context
class_program.cpp:22: error: no matching function for call to ‘Data::printAll(int&)’
class_program.cpp:11: note: candidates are: int Data::printAll()
Can anyone help me...? Thank you very much!