#include #include class Person { private: static const std::size_t MAX_NAME = 30; static const std::size_t MAX_ADDRESS = 30; char name[MAX_NAME]; char address[MAX_ADDRESS]; unsigned int age; float salary; public: void getName(); void getAddress(); void getAge(); void getSalary(); void setName(const char[30], size_t); void setAddress(const char[100], size_t); void setAge(unsigned int); void setSalary(float); }; inline void Person::getName() { std::cout << name << std::endl; } inline void Person::getAddress() { std::cout << address << std::endl; } inline void Person::getAge() { std::cout << age << std::endl; } inline void Person::getSalary() { std::cout << salary << std::endl; } inline void Person::setName(const char name[], size_t size) { strncpy(this->name, name, (size <= MAX_NAME ? size : MAX_NAME - 1)); if (size > MAX_NAME) this->name[MAX_NAME - 1] = '\0'; } inline void Person::setAddress(const char address[], size_t size) { strncpy(this->address, address, (size <= MAX_ADDRESS ? size : MAX_ADDRESS - 1)); if (size > MAX_NAME) this->name[MAX_NAME - 1] = '\0'; } inline void Person::setAge(unsigned int age) { this->age = age; } inline void Person::setSalary(float salary) { this->salary = salary; } int main() { Person person; const char name[] = "Retard Singh"; const char address[] = "420 RetardVille"; unsigned int age = 44; float salary = 4.44; person.setName(name, sizeof(name)); person.setAddress(address, sizeof(address)); person.setAge(age); person.setSalary(salary); person.getName(); person.getAddress(); person.getAge(); person.getSalary(); return 0; }