mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
73331b45e0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
35 lines
412 B
C
35 lines
412 B
C
#include <stdio.h>
|
|
|
|
class Person {
|
|
private:
|
|
const char *name;
|
|
int age;
|
|
|
|
public:
|
|
Person(const char *name, int age);
|
|
const char * get_name();
|
|
int get_age();
|
|
void set_age(int i);
|
|
};
|
|
|
|
Person::Person(const char *name, int age)
|
|
: name(name), age(age)
|
|
{
|
|
/* empty */
|
|
}
|
|
|
|
const char *
|
|
Person::get_name()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
int
|
|
Person::get_age(){
|
|
return age;
|
|
}
|
|
|
|
void
|
|
Person::set_age(int i){
|
|
age = i;
|
|
}
|