-1

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;
       }
MikeCAT
  • 73,922
  • 11
  • 45
  • 70
wade aston
  • 105
  • 3
  • 14
  • 2
    You probably should consult a [good book about some basics](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) or tutorial before asking your next question. The system bans for asking poor questions pretty quickly. – πάντα ῥεῖ May 02 '16 at 16:10

1 Answers1

2

You don't have to and mustn't declare initializer list.

Try changing

CruiseShip(string, string, int):Ship(string,string);

to

CruiseShip(string, string, int);
MikeCAT
  • 73,922
  • 11
  • 45
  • 70