hi I am new in c++ although I am reading about ti for a while now :).
recently a made a silly code that I can not compile so please some help about it.
ps: befo you even star to read it the following errors ocure while compilling Undefined reference to :base_employ,menager,engineers,researcher

#include<iostream>
#include<string>

using namespace std;

class base_employ
{
      protected:
                string First_Name;
                string Last_Name;
                double Salery;
      public:
             base_employ();
             base_employ( string &FN, string &LN, double S)
             { First_Name=FN;
               Last_Name=LN;
               Salery=S;
             }
             void get_FN(string FN)
             { getline(cin,FN);}
             string set_FN()
             {return First_Name;}
             void get_LN(string LN)
             { getline(cin,LN);}
             string set_LN()
             {return Last_Name;}
             void get_S(double S)
             {cin>>S;}
             double set_S()
             {return Salery;}
             void Print()
             { cout<<"First Name:"<<" "<<First_Name<<endl;
               cout<<"Last Name:"<<" "<<Last_Name<<endl;
               cout<<"Salery:"<<" "<<Salery<<endl;
             }
             };
             

class manager : public base_employ
{ private:
          int Meet_per_week;
          int Vacation_days_pyear;
  public:
         manager();
         manager( string &FN, string &LN, double S,int MPW,int VdPY) : base_employ (FN,LN,S)//metodata menager nasleduva od metodata base_employ
         { Meet_per_week=MPW;
           Vacation_days_pyear=VdPY;
         }
         void get_MPW(int MPW)
         { cin>>MPW; }
         int set_MPW()
         { return Meet_per_week;}
         void get_VdPY(int VdPY)
         {cin>>VdPY;}
         int set_VdPY()
         {return Vacation_days_pyear;}
         void Print_M_Stat()
         { base_employ::Print();
           cout<<"Meetingd per week:"<<" "<<Meet_per_week<<endl;
           cout<<"Vacation days per year:"<<" "<<Vacation_days_pyear<<endl;
         }};
         
class engineers : public base_employ
{ private:
          char Value; //Y ako znaat C++ & N ano ne go poznavaat
          int Years_Experience;
          string sort_engineer;
  public:
         engineers();
         engineers( string &FN, string &LN, double S, char V, int YE,string &sortE ) : base_employ (FN,LN,S)
         { Value=V;
           Years_Experience=YE;
           sort_engineer=sortE;
         }
         void get_value(char V)
         {cin>>V;}
         char set_value()
         { return Value;}
         void get_YE(int YE)
         { cin>>YE;}
         int set_YE()
         {return Years_Experience;}
         void get_sortE(string sortE)
         {getline(cin,sortE);}
         string set_sortE()
         {return sort_engineer;}
         void print_E_Stat()
         { base_employ::Print();
           if(Value=='Y'){
           cout<<"The Engineer knows C++"<<endl;}
           cout<<"Years of Experience:"<<Years_Experience<<endl;
           cout<<"Type of Engineer:"<<sort_engineer<<endl;
         }};
         
class researcher : public base_employ
{ private:
          string School_of_PhD;
          string topic_of_PhD;
 public:
        researcher ();
        researcher( string &FN, string &LN, double S,string &SPhD,string &TPhD) : base_employ (FN,LN,S)
        {School_of_PhD=SPhD;
         topic_of_PhD=TPhD;
        }
        void get_SPhD(string SPhD)
        {getline(cin,SPhD);}
        string set_SPhD()
        {return School_of_PhD;}
        void get_TPhD(string TPhD)
        {getline(cin,TPhD);}
        string set_TPhD()
        {return topic_of_PhD;}
        void print_S_Stat()
        {base_employ::Print();
         cout<<"School where the researcher recived his/hers PhD:"<<" "<<School_of_PhD<<endl;
         cout<<"The topic of their PhD:"<<" "<<topic_of_PhD<<endl;}
         };

         
int main()
{
 string  FN, LN, sort_E, SPhD, TPhD;
 double S;
 char V;
 int MPW,VdPY,YE,choise;
 base_employ B;
 manager M;
 M.get_MPW(MPW);
 engineers  E;
 researcher R;
 
 return 0;
}
mvmalderen commented: if( post == 1 && code_tags ) rep += 10; :P +10
VernonDozier commented: Code tags on first post! +17

Recommended Answers

All 2 Replies

You haven't defined the bodies for the constructors: manager(); etc...

Edit::

[B]/*** Fixes to make it compile are made in Green ***/[/B]
#include<iostream>
#include<string>

using namespace std;

class base_employ
{
      protected:
                string First_Name;
                string Last_Name;
                double Salery;
      public:
             base_employ() [B]{}[/B]
             base_employ( string &FN, string &LN, double S)
             { First_Name=FN;
               Last_Name=LN;
               Salery=S;
             }
             void get_FN(string FN)
             { getline(cin,FN);}
             string set_FN()
             {return First_Name;}
             void get_LN(string LN)
             { getline(cin,LN);}
             string set_LN()
             {return Last_Name;}
             void get_S(double S)
             {cin>>S;}
             double set_S()
             {return Salery;}
             void Print()
             { cout<<"First Name:"<<" "<<First_Name<<endl;
               cout<<"Last Name:"<<" "<<Last_Name<<endl;
               cout<<"Salery:"<<" "<<Salery<<endl;
             }
             };
             

class manager : public base_employ
{ private:
          int Meet_per_week;
          int Vacation_days_pyear;
  public:
         manager() [B]{}[/B]
         manager( string &FN, string &LN, double S,int MPW,int VdPY) : base_employ (FN,LN,S)//metodata menager nasleduva od metodata base_employ
         { Meet_per_week=MPW;
           Vacation_days_pyear=VdPY;
         }
         void get_MPW(int MPW)
         { cin>>MPW; }
         int set_MPW()
         { return Meet_per_week;}
         void get_VdPY(int VdPY)
         {cin>>VdPY;}
         int set_VdPY()
         {return Vacation_days_pyear;}
         void Print_M_Stat()
         { base_employ::Print();
           cout<<"Meetingd per week:"<<" "<<Meet_per_week<<endl;
           cout<<"Vacation days per year:"<<" "<<Vacation_days_pyear<<endl;
         }};
         
class engineers : public base_employ
{ private:
          char Value; //Y ako znaat C++ & N ano ne go poznavaat
          int Years_Experience;
          string sort_engineer;
  public:
         engineers() [B]{}[/B]
         engineers( string &FN, string &LN, double S, char V, int YE,string &sortE ) : base_employ (FN,LN,S)
         { Value=V;
           Years_Experience=YE;
           sort_engineer=sortE;
         }
         void get_value(char V)
         {cin>>V;}
         char set_value()
         { return Value;}
         void get_YE(int YE)
         { cin>>YE;}
         int set_YE()
         {return Years_Experience;}
         void get_sortE(string sortE)
         {getline(cin,sortE);}
         string set_sortE()
         {return sort_engineer;}
         void print_E_Stat()
         { base_employ::Print();
           if(Value=='Y'){
           cout<<"The Engineer knows C++"<<endl;}
           cout<<"Years of Experience:"<<Years_Experience<<endl;
           cout<<"Type of Engineer:"<<sort_engineer<<endl;
         }};
         
class researcher : public base_employ
{ private:
          string School_of_PhD;
          string topic_of_PhD;
 public:
        researcher () [B]{}[/B]
        researcher( string &FN, string &LN, double S,string &SPhD,string &TPhD) : base_employ (FN,LN,S)
        {School_of_PhD=SPhD;
         topic_of_PhD=TPhD;
        }
        void get_SPhD(string SPhD)
        {getline(cin,SPhD);}
        string set_SPhD()
        {return School_of_PhD;}
        void get_TPhD(string TPhD)
        {getline(cin,TPhD);}
        string set_TPhD()
        {return topic_of_PhD;}
        void print_S_Stat()
        {base_employ::Print();
         cout<<"School where the researcher recived his/hers PhD:"<<" "<<School_of_PhD<<endl;
         cout<<"The topic of their PhD:"<<" "<<topic_of_PhD<<endl;}
         };

         
int main()
{
 string  FN, LN, sort_E, SPhD, TPhD;
 double S;
 char V;
 int MPW,VdPY,YE,choise;
 base_employ B;
 manager M;
 M.get_MPW(MPW);
 engineers  E;
 researcher R;
 
 return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.