1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/dl/sample/c++sample.C
ttate 73331b45e0 Add a sample which shows how to deal with C++ libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-20 16:09:44 +00:00

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;
}