Trying to debug my program and getting some error's I cannot figure out.
CruiseShip.h: In constructor ‘CruiseShip::CruiseShip(std::string, std::string, int)’:
CruiseShip.h:16: error: expected primary-expression before ‘,’ token
CruiseShip.h:16: error: expected primary-expression before ‘)’ token
CruiseShip.h:16: error: expected ‘{’ at end of input
CruiseShip.cpp: At global scope:
CruiseShip.cpp:11: error: expected ‘)’ before ‘n’
CruiseShip.cpp: In function ‘void print()’:
CruiseShip.cpp:20: error: ‘passengers’ was not declared in this scope
CruiseShip.h
#ifndef CRUISESHIP_H
#define CRUISESHIP_H
#include "Ship.h"
#include <string>
using namespace std;
//class Ship;
class CruiseShip:public Ship{
private:
int passengers;
Ship::Ship s;
public:
CruiseShip(string, string, int):Ship(string,string);
virtual void print();
};
#endif
CruiseShip.cpp
#include "CruiseShip.h"
#include "Ship.h"
#include <iostream>
using namespace std;
Ship s;
CruiseShip(string n, string y, int p) : Ship(n,y)
{
passengers=p;
}
void print()
{
cout<<"Name: "<<s.getName()<<"\nMaximum passengers:"<<passengers<<endl;
cout<<"-------------------------"<<endl;
}