2014-05-20 22:21:07 -04:00
|
|
|
import mem;
|
|
|
|
|
import io;
|
|
|
|
|
|
|
|
|
|
typedef AnObject {
|
2014-08-01 00:45:48 -07:00
|
|
|
|int| a;
|
|
|
|
|
|int| b;
|
|
|
|
|
|char*| c;
|
2014-05-20 22:21:07 -04:00
|
|
|
|
2014-08-01 00:45:48 -07:00
|
|
|
|void| print() {
|
2014-05-20 22:21:07 -04:00
|
|
|
print(a+b);
|
|
|
|
|
print("\n");
|
|
|
|
|
print(c);
|
|
|
|
|
print("\n");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-08-01 00:45:48 -07:00
|
|
|
|int| main() {
|
|
|
|
|
|AnObject*| ptr = new<AnObject>();
|
2014-05-20 22:21:07 -04:00
|
|
|
ptr->a = 4;
|
|
|
|
|
ptr->b = 7;
|
|
|
|
|
ptr->c = "Hello decent memory! Quite a nice feeling\n";
|
|
|
|
|
ptr->print();
|
|
|
|
|
delete<AnObject>(ptr);
|
|
|
|
|
|
|
|
|
|
return 0;
|
2014-08-01 00:45:48 -07:00
|
|
|
}
|