hello, Im kinda stuck on how to initialize the class inside the main. Or what to write instead of the ??? inside the main.
Thank you in advance...
//**********************************************************
// Work In Progress
// Author Armen Babakanian
// A complete set of examples to use reference and pointer issues
// in related to functions and classes
//**********************************************************
#include <iostream>
#include <string>
using namespace std;
class Job
{
public:
Job(string compName, string titl, double sal)
: companyName(compName), title(titl), salary(sal){};
Job(){};
string& getCompanyName() {return companyName;};
string& getTitle() {return title;};
double getSalary() {return salary;};
void setCompanyName(string name) {companyName = name;};
void setTitleName(string name) {title = name;};
void setSalery(double name) {salary = name;};
private:
string companyName;
string title;
double salary;
};
//*********************************************************8
class person
{
public:
person(string name, string last, string compName, string title, double sal, Job& job)
: m_name(name), m_last(last), m_firstJob(job){};
int getAge(){return m_age;};
string getName(){return m_name;};
string getLast(){return m_last;};
void setAge(int age) {m_age = age;};
Job& get1stJob(){ return m_firstJob;};
//------------------------------------
Job* get2ndJob(){ return m_secondJob;};
private:
string m_name;
string m_last;
int m_age;
Job& m_firstJob;
Job* m_secondJob;
};
//*********************************************************8
void main()
{
//Job first;
person RafaelB("Rafael","BakerMan", "Starbucks", "maneger", 8.50,Job first);
RafaelB.setAge(22);
cout << RafaelB.getName() << " --" << RafaelB.getLast() << " --" << RafaelB.getAge() << endl;
cout << RafaelB.get1stJob().getCompanyName() << " --" << RafaelB.get1stJob().getTitle() << " --" << RafaelB.get1stJob().getSalary() << endl;
}