Created
October 24, 2012 16:56
-
-
Save Jack2/3947320 to your computer and use it in GitHub Desktop.
[C++]compile_err_01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
class Job { | |
public: | |
int salary; | |
char company[]; | |
}; | |
class Feature { | |
public: | |
int age; | |
int tall; | |
}; | |
class Person { | |
public: | |
void print(); | |
Job job; | |
Feature feature; | |
}; | |
void Person::print() | |
{ | |
std::cout << "salary : " << job.salary << std::endl; | |
std::cout << "company: " << job.company << std::endl; | |
std::cout << "age : " << feature.age << std::endl; | |
std::cout << "tall : " << feature.tall << std::endl; | |
} | |
int main() | |
{ | |
Person jack2; | |
jack2.job.salary = 5000; | |
jack2.job.company = "INetCop"; | |
jack2.feature.age = 26; | |
jack2.feature.tall = 183; | |
jack2.print(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment