Multiple Inheritance

This is my first time using multiple inheritance. Could someone please help me fix/explain what I did wrong?
Here is what outputs when I compile:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
cd 'C:\Users\Mouse\Documents\NetBeansProjects\Mpierce_Mod5Asmt_080417'
C:\cygwin64\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Mouse/Documents/NetBeansProjects/Mpierce_Mod5Asmt_080417'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/mpierce_mod5asmt_080417.exe
make[2]: Entering directory '/cygdrive/c/Users/Mouse/Documents/NetBeansProjects/Mpierce_Mod5Asmt_080417'
mkdir -p build/Debug/Cygwin-Windows
rm -f "build/Debug/Cygwin-Windows/MarsAlien.o.d"
g++    -c -g -MMD -MP -MF "build/Debug/Cygwin-Windows/MarsAlien.o.d" -o build/Debug/Cygwin-Windows/MarsAlien.o MarsAlien.cpp
In file included from MarsAlien.cpp:1:0:
MarsAlien.h: In constructor 'MarsAlien::MarsAlien(std::string, std::string, std::string, std::string, std::string, std::string)':
MarsAlien.h:19:40: error: no matching function for call to 'Alien::Alien(std::string&, std::string&, std::string&)'
             :alien(skin, language, body)
                                        ^
In file included from MarsAlien.h:3:0,
                 from MarsAlien.cpp:1:
Alien.h:6:7: note: candidate: Alien::Alien()
 class Alien
       ^~~~~
Alien.h:6:7: note:   candidate expects 0 arguments, 3 provided
Alien.h:6:7: note: candidate: Alien::Alien(const Alien&)
Alien.h:6:7: note:   candidate expects 1 argument, 3 provided
Alien.h:6:7: note: candidate: Alien::Alien(Alien&&)
Alien.h:6:7: note:   candidate expects 1 argument, 3 provided
make[2]: *** [nbproject/Makefile-Debug.mk:87: build/Debug/Cygwin-Windows/MarsAlien.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Mouse/Documents/NetBeansProjects/Mpierce_Mod5Asmt_080417'
make[1]: *** [nbproject/Makefile-Debug.mk:73: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Mouse/Documents/NetBeansProjects/Mpierce_Mod5Asmt_080417'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2


Alien.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef ALIEN_H
#define ALIEN_H
#include <string>
using namespace std;

class Alien
{
private:
    string skin;
    string language;
    string smart;
    string body;
public:
    Aliens()
    {
    }
    
    Aliens(string skin, string language, string smart, string body)
    {
    }
    
    void setSkin(string skin);
    void setLanguage(string language);
    void setSmart(string smart);
    void setBody(string body);
};

#endif /* ALIEN_H */ 


Alien.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdlib>
#include "Alien.h"
using namespace std;

void setSkin(string skin)
{
    skin = "has skin";
}

void setLanguage(string language)
{
    language = "can talk";
}
void setSmart(string smart)
{
    smart = "smart";
}
    
void setBody(string body)
{
    body = "has hands, legs, and brains";
}


MarsAlien.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef MARSALIEN_H
#define MARSALIEN_H
#include "Alien.h"
using namespace std;

class MarsAlien : public Alien
{
private:
    Alien alien;
    string skincolor;
    string marslanguage;
    string height;
public:
    MarsAlien()
    {
    }
    
    MarsAlien(string skin, string skincolor, string language, string marslanguage, string body, string height)
            :alien(skin, language, body)
    {
    }
        
    void setSkinColor(string skincolor);
    void setMarsLanguage(string marslanguage);
    void setHeight(string height);
};

#endif /* MARSALIEN_H */ 


MarsAlien.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "MarsAlien.h"
using namespace std;

void setSkinColor(string skincolor)
{
    skincolor = "skin is red";
}

void setMarsLanguage(string marslanguage)
{
    marslanguage = "can talk marsspeak";
}
void setHeight(string height)
{
    height = "tall";
}


PlutoAlien.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef PLUTOALIEN_H
#define PLUTOALIEN_H
#include <string>
#include "Alien.h"
using namespace std;

class PlutoAlien : public Alien
{
private:
    Alien alien;
    string skincolor;
    string plutolanguage;
    string height;
public:
    PlutoAlien()
    {
    }
    
    PlutoAlien(string skin, string skincolor, string language, string plutolanguage, string body, string height)
            :alien(skin, language, body)
    {
    }
        
    void setSkinColor(string skincolor);
    void setPlutoLanguage(string plutolanguage);
    void setHeight(string height);
};

#endif /* PLUTOALIEN_H */ 


PlutoAlien.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <cstdlib>
#include "PlutoAlien.h"
using namespace std;

void setSkinColor(string skincolor)
{
    skincolor = "skin is iridescent";
}

void setPlutoLanguage(string plutolanguage)
{
    plutolanguage = "can talk plutospeak";
}
void setHeight(string height)
{
    height = "average height";
}


VenusAlien.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef VENUSALIEN_H
#define VENUSALIEN_H
#include <string>
#include "Alien.h"
using namespace std;

class VenusAlien : public Alien
{
private:
    Alien alien;
    string skincolor;
    string venuslanguage;
    string height;
public:
    VenusAlien()
    {
    }
    
    VenusAlien(string skin, string skincolor, string language, string venuslanguage, string body, string height)
            :alien(skin, language, body)
    {
    }
        
    void setSkinColor(string skincolor);
    void setVenusLanguage(string venuslanguage);
    void setHeight(string height);
};

#endif /* VENUSALIEN_H */ 


VenusAlien.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <cstdlib>
#include "VenusAlien.h"
using namespace std;

void setSkinColor(string skincolor)
{
    skincolor = "skin is blue";
}

void setVenusLanguage(string venuslanguage)
{
    venuslanguage = "can talk venusspeak";
}
void setHeight(string height)
{
    height = "below average height";
}


Soldier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef SOLDIER_H
#define SOLDIER_H
#include <string>
using namespace std;

class Soldier
{
private:
    string uniform;
    string run;
    string weapon;
public:
    Soldier()
    {
    }
    
    Soldier(string uniform, string run, string weapon)
    {
    }
    
    void setUniform(string uniform);
    void setRun(string run);
    void setWeapon(string weapon);
};


#endif /* SOLDIER_H */ 


Soldier.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <cstdlib>
#include "Soldier.h"
using namespace std;

void setUniform(string uniform)
{
    uniform = "wears uniforms";
}

void setRun(string run)
{
    run = "can run";
}
void setWeapon(string weapon)
{
    weapon = "can shoot weapons";
}


MedicSoldier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef MEDICSOLDIER_H
#define MEDICSOLDIER_H
#include <string>
#include "Soldier.h"
using namespace std;

class MedicSoldier : public Soldier
{
private:
    Soldier soldier;
    string skill;
public:
    MedicSoldier()
    {
    }
    
    MedicSoldier(string uniform, string run, string skill, string weapon)
            :soldier(uniform, run, weapon)
    {
    }
        
    void setSkill(string skill);
};


#endif /* MEDICSOLDIER_H */ 


MedicSoldier.cpp
1
2
3
4
5
6
7
8
#include <cstdlib>
#include "MedicSoldier.h"
using namespace std;

void setSkill(string skill)
{
    skill= "can heal";
}


PilotSoldier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef PILOTSOLDIER_H
#define PILOTSOLDIER_H
#include <string>
#include "Soldier.h"
using namespace std;

class PilotSoldier : public Soldier
{
private:
    Soldier soldier;
    string skill;
public:
    PilotSoldier()
    {
    }
    
    PilotSoldier(string uniform, string run, string skill, string weapon)
            :soldier(uniform, run, weapon)
    {
    }
        
    void setSkill(string skill);
};


#endif /* PILOTSOLDIER_H */ 


PilotSoldier.cpp
1
2
3
4
5
6
7
8
#include <cstdlib>
#include "PilotSoldier.h"
using namespace std;

void setSkill(string skill)
{
    skill= "can fly ships/planes";
}


TankSoldier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef TANKSOLDIERS_H
#define TANKSOLDIERS_H
#include <string>
#include "Soldier.h"
using namespace std;

class TankSoldier : public Soldier
{
private:
    Soldier soldier;
    string skill;
public:
    TankSoldier()
    {
    }
    
    TankSoldier(string uniform, string run, string skill, string weapon)
            :soldier(uniform, run, weapon)
    {
    }
        
    void setSkill(string skill);
};


#endif /* TANKSOLDIERS_H */ 


TankSoldier.cpp
1
2
3
4
5
6
7
8
#include <cstdlib>
#include "TankSoldier.h"
using namespace std;

void setSkill(string skill)
{
    skill= "can maneuver and shoot with tanks";
}


MarsTankSoldier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef MARSTANKSOLDIER_H
#define MARSTANKSOLDIER_H
#include <string>
#include "MarsAlien.h"
#include "TankSoldier.h"
using namespace std;

class MarsTankAlien : public MarsAlien, public TankSoldier
{
private:
    MarsAlien marsalien;
    TankSoldier tanksoldier;
public:
    MarsTankAlien()
    {
    }
    
    MarsTankAlien(string skin, string skincolor, string language, string marslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :marsalien(skin, skincolor, language, marslanguage, body, height)
    {
    }
    
    MarsTankAlien(string skin, string skincolor, string language, string marslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :tanksoldier(uniform, run, weapon, skill)
    {
    }
    
    void getSkin(string skin);
    void getLanguage(string language);
    void getBody(string body);
    void getSkinColor(string skincolor);
    void getMarsLanguage(string marslanguage);
    void getHeight(string height);
    void getUniform(string uniform);
    void getRun(string run);
    void getWeapon(string weapon);
    void getSkill(string skill);
};


#endif /* MARSTANKSOLDIER_H */ 


MarsTankSoldier.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
#include "MarsTankSoldier.h"
using namespace std;

string getSkin(string skin)
{
    return skin;
}

string getlanguage(string language)
{
    return language;
}

string getBody(string body)
{
    return body;
}

string getSkinColor(string skincolor)
{
    return skincolor;
}

string getMarsLanguage(string marslanguage)
{
    return marslanguage;
}

string getHeight(string height)
{
    return height;
}

string getUniform(string uniform)
{
    return uniform;
}

string getRun(string run)
{
    return run;
}

string getWeapon(string weapon)
{
    return weapon;
}

string getSkill(string skill)
{
    return skill;
}


PlutoMedic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef PLUTOMEDIC_H
#define PLUTOMEDIC_H
#include <string>
#include "PlutoAlien.h"
#include "MedicSoldier.h"
using namespace std;

class PlutoMedic : public PlutoAlien, public MedicSoldier
{
private:
    PlutoAlien plutoalien;
    MedicSoldier medicsoldier;
public:
    PlutoMedic()
    {
    }
    
    PlutoMedic(string skin, string skincolor, string language, string plutolanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :plutoalien(skin, skincolor, language, plutolanguage, body, height)
    {
    }
    
    PlutoMedic(string skin, string skincolor, string language, string plutolanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :medicsoldier(uniform, run, weapon, skill)
    {
    }
    
    void getSkin(string skin);
    void getLanguage(string language);
    void getBody(string body);
    void getSkinColor(string skincolor);
    void getPlutoLanguage(string plutolanguage);
    void getHeight(string height);
    void getUniform(string uniform);
    void getRun(string run);
    void getWeapon(string weapon);
    void getSkill(string skill);
};


#endif /* PLUTOMEDIC_H */ 


PlutoMedic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
#include "PlutoMedic.h"
using namespace std;

string getSkin(string skin)
{
    return skin;
}

string getlanguage(string language)
{
    return language;
}

string getBody(string body)
{
    return body;
}

string getSkinColor(string skincolor)
{
    return skincolor;
}

string getPlutoLanguage(string plutolanguage)
{
    return plutolanguage;
}

string getHeight(string height)
{
    return height;
}

string getUniform(string uniform)
{
    return uniform;
}

string getRun(string run)
{
    return run;
}

string getWeapon(string weapon)
{
    return weapon;
}

string getSkill(string skill)
{
    return skill;
}


PlutoPilot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef PLUTOPILOT_H
#define PLUTOPILOT_H
#include <string>
#include "PlutoAlien.h"
#include "PilotSoldier.h"
using namespace std;

class PlutoPilot : public PlutoAlien, public PilotSoldier
{
private:
    PlutoAlien plutoalien;
    PilotSoldier pilotsoldier;
public:
    PlutoPilot()
    {
    }
    
    PlutoPilot(string skin, string skincolor, string language, string plutolanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :plutoalien(skin, skincolor, language, plutolanguage, body, height)
    {
    }
    
    PlutoPilot(string skin, string skincolor, string language, string plutolanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :pilotsoldier(uniform, run, weapon, skill)
    {
    }
    
    void getSkin(string skin);
    void getLanguage(string language);
    void getBody(string body);
    void getSkinColor(string skincolor);
    void getPlutoLanguage(string plutolanguage);
    void getHeight(string height);
    void getUniform(string uniform);
    void getRun(string run);
    void getWeapon(string weapon);
    void getSkill(string skill);
};

#endif /* PLUTOPILOT_H */ 


PlutoPilot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
#include "PlutoPilot.h"
using namespace std;

string getSkin(string skin)
{
    return skin;
}

string getlanguage(string language)
{
    return language;
}

string getBody(string body)
{
    return body;
}

string getSkinColor(string skincolor)
{
    return skincolor;
}

string getPlutoLanguage(string plutolanguage)
{
    return plutolanguage;
}

string getHeight(string height)
{
    return height;
}

string getUniform(string uniform)
{
    return uniform;
}

string getRun(string run)
{
    return run;
}

string getWeapon(string weapon)
{
    return weapon;
}

string getSkill(string skill)
{
    return skill;
}


VenusMedic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef VENUSMEDIC_H
#define VENUSMEDIC_H
#include <string>
#include "VenusAlien.h"
#include "MedicSoldier.h"
using namespace std;

class VenusMedic : public VenusAlien, public MedicSoldier
{
private:
    VenusAlien venusalien;
    MedicSoldier medicsoldier;
public:
    VenusMedic()
    {
    }
    
    VenusMedic(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :venusalien(skin, skincolor, language, venuslanguage, body, height)
    {
    }
    
    VenusMedic(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :medicsoldier(uniform, run, weapon, skill)
    {
    }
    
    void getSkin(string skin);
    void getLanguage(string language);
    void getBody(string body);
    void getSkinColor(string skincolor);
    void getVenusLanguage(string venuslanguage);
    void getHeight(string height);
    void getUniform(string uniform);
    void getRun(string run);
    void getWeapon(string weapon);
    void getSkill(string skill);
};

#endif /* VENUSMEDIC_H */ 


VenusMedic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
#include "VenusMedic.h"
using namespace std;

string getSkin(string skin)
{
    return skin;
}

string getlanguage(string language)
{
    return language;
}

string getBody(string body)
{
    return body;
}

string getSkinColor(string skincolor)
{
    return skincolor;
}

string getVenusLanguage(string venuslanguage)
{
    return venuslanguage;
}

string getHeight(string height)
{
    return height;
}

string getUniform(string uniform)
{
    return uniform;
}

string getRun(string run)
{
    return run;
}

string getWeapon(string weapon)
{
    return weapon;
}

string getSkill(string skill)
{
    return skill;
}


VenusPilot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef VENUSPILOT_H
#define VENUSPILOT_H
#include <string>
#include "VenusAlien.h"
#include "PilotSoldier.h"
using namespace std;

class VenusPilot : public VenusAlien, public PilotSoldier
{
private:
    VenusAlien venusalien;
    PilotSoldier pilotsoldier;
public:
    VenusPilot()
    {
    }
    
    VenusPilot(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :venusalien(skin, skincolor, language, venuslanguage, body, height)
    {
    }
    
    VenusPilot(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :pilotsoldier(uniform, run, weapon, skill)
    {
    }
    
    void getSkin(string skin);
    void getLanguage(string language);
    void getBody(string body);
    void getSkinColor(string skincolor);
    void getVenusLanguage(string venuslanguage);
    void getHeight(string height);
    void getUniform(string uniform);
    void getRun(string run);
    void getWeapon(string weapon);
    void getSkill(string skill);
};

#endif /* VENUSPILOT_H */ 


VenusPilot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
#include "VenusPilot.h"
using namespace std;

string getSkin(string skin)
{
    return skin;
}

string getlanguage(string language)
{
    return language;
}

string getBody(string body)
{
    return body;
}

string getSkinColor(string skincolor)
{
    return skincolor;
}

string getVenusLanguage(string venuslanguage)
{
    return venuslanguage;
}

string getHeight(string height)
{
    return height;
}

string getUniform(string uniform)
{
    return uniform;
}

string getRun(string run)
{
    return run;
}

string getWeapon(string weapon)
{
    return weapon;
}

string getSkill(string skill)
{
    return skill;
}


OutPutAliens.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef OUTPUTALIENS_H
#define OUTPUTALIENS_H
#include <cstdlib>
#include "MarsTankSoldier.h"
#include "PlutoPilot.h"
#include "PlutoMedic.h"
#include "VenusPilot.h"
#include "VenusMedic.h"
using namespace std;

class OutPutAliens
{
private:
    
public:
    void AlienChoice();
};

#endif /* OUTPUTALIENS_H */ 


OutPutAliens.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "OutPutAliens.h"
using namespace std;

void AlienChoice() 
{
    int choice = 0;
    MarsTankAlien marssoldier1;
    PlutoPilot plutosoldier1;
    PlutoMedic plutosoldier2;
    VenusPilot venussoldier1;
    VenusMedic venussoldier2;
    cout << "1. Mars Tank Soldiers";
    cout << "2. Pluto Pilots";
    cout << "3. Pluto Medics";
    cout << "4. Venus Pilots";
    cout << "5. Venus Medics";
    cout << "Type a choice.\n";
    cin >> choice;
    if(choice<1||choice>5)
    {
        cout << "That is not a valid option, please choose a menu item between 1-5.";
        cin >> choice;
    }
    switch(choice)
    {
        case 1:
            cout << marssoldier1;
            main();
            break;
        case 2:
            cout << plutosoldier1;
            main();
            break;
        case 3:
            cout << plutosoldier2;
            main();
            break;
        case 4:
            cout << venussoldier1;
            main();
            break;
        case 5:
            cout << venussoldier2;
            main();
            break;
    }
}


main.cpp
1
2
3
4
5
6
7
8
9
#include <cstdlib>
#include "OutPutAliens.h"
using namespace std;

int main() 
{
    OutPutAliens aliensoutput;
    aliensoutput.AlienChoice();
}
Why would you write all of this code before testing any of it?

Calling main is forbidden.

To implement a function as part of a class, you must indicate the class it is a part of:
void AlienChoice() { // ... }
alone in a cpp file is not a member of any class. It is a freestanding function. You have this mistake all over the place.

Reduce your code to a more manageable example and test more often.
Last edited on
Even if you added the requisite Alien:: these functions do absolutely nothing since they are setting their parameter and then returning. The parameters are shadowing the class members.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void setSkin(string skin)
{
    skin = "has skin";
}
void setLanguage(string language)
{
    language = "can talk";
}
void setSmart(string smart)
{
    smart = "smart";
}    
void setBody(string body)
{
    body = "has hands, legs, and brains";
}

Presumably you want something like:
1
2
3
4
void Alien::setSkin(string skin_in)
{
    skin = skin_in;
}

And "output" is a single english word, so capitalizing the P is just weird.
1
2
3
4
5
6
7
8
9
 VenusPilot(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :venusalien(skin, skincolor, language, venuslanguage, body, height)
    {
    }
    
    VenusPilot(string skin, string skincolor, string language, string venuslanguage, string body, string height, string uniform, string run, string weapon, string skill)
            :pilotsoldier(uniform, run, weapon, skill)
    {
    }


There are several conceptual problems with this code:

The constructors have 10 parameters, but the member initialization list only sets 4 or 6 of them which are the members of 1 of the parent classes. Having 2 constructors to set members of both parent classes won't work like that, only 1 constructor is called when a class is instantiated.

The two constructors are identical in terms of their parameter number and type, so this won't work for function overloading.

What is the point of having the VenusPilot class if all it does is return the values of variables that exist in the parent classes?

Function implementations should pass std::string by const reference:

1
2
3
4
void Alien::setSkin(const string& skin_in)
{
    skin = skin_in;
}


Get functions should be marked const:

1
2
3
4
string VenusPilot::getWeapon(string weapon) const
{
    return weapon;
}


But that code won't work: the variable weapon is private, so you will have to call a get function instead.

This:
cout << marssoldier1;

Won't work unless you implement an operator<< function to tell how to output values from that variable.
Topic archived. No new replies allowed.