Skip to content

Instantly share code, notes, and snippets.

@Jack2
Created October 24, 2012 16:56
Show Gist options
  • Save Jack2/3947320 to your computer and use it in GitHub Desktop.
Save Jack2/3947320 to your computer and use it in GitHub Desktop.
[C++]compile_err_01
#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