#include <iostream>
#include <string>
using namespace std;
#include <string>
using namespace std;
class Data{
public:
void setName(string);
void setAge(int);
string getName();
int getAge();
private:
string name;
int age;
};
void Data::setName(string name){
Data::name = name;
}
void Data::setAge(int age){
Data::age = age;
}
string Data::getName(){
return Data::name;
}
int Data::getAge(){
return Data::age;
}
int main(int argc, char *argv[]){
system("color 2f");
Data data;
data.setName("Indonesia");
data.setAge(70);
cout << data.getName() << endl;
cout << data.getAge() << endl;
return 0;
}
No comments:
Post a Comment