Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <string>
- class DOB {
- public:
- void set( std::string n ) {
- name = n;
- }
- void print() {
- static int i = 0;
- printf( "%d %s\n", i, name.c_str() );
- i += 1;
- }
- std::string name;
- };
- class T {
- public:
- DOB dob;
- };
- int main( int argc, char** argv ) {
- DOB a;
- a.print();
- a.set( "Harr" );
- a.print();
- T b;
- b.dob.print();
- b.dob.set( "Harr" );
- b.dob.print();
- }
Advertisement
Add Comment
Please, Sign In to add comment