Click here to Skip to main content
12,692,288 members (30,656 online)

C / C++ / MFC

QuestionGraphics Interface (game) Pin
April Fans13-Dec-12 19:37
memberApril Fans13-Dec-12 19:37 
AnswerRe: Graphics Interface (game) Pin
Richard MacCutchan13-Dec-12 23:40
mvpRichard MacCutchan13-Dec-12 23:40 
GeneralRe: Graphics Interface (game) Pin
April Fans20-Dec-12 20:13
memberApril Fans20-Dec-12 20:13 
QuestionCompilation Problem Pin
BobInNJ13-Dec-12 15:15
memberBobInNJ13-Dec-12 15:15 
AnswerRe: Compilation Problem Pin
Graham Breach13-Dec-12 22:58
memberGraham Breach13-Dec-12 22:58 
GeneralRe: Compilation Problem Pin
BobInNJ14-Dec-12 12:16
memberBobInNJ14-Dec-12 12:16 
GeneralRe: Compilation Problem Pin
Graham Breach15-Dec-12 0:31
memberGraham Breach15-Dec-12 0:31 
Questionerror C2678: binary '=' Pin
alaaan7313-Dec-12 7:41
memberalaaan7313-Dec-12 7:41 
error message
.cpp(44): error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)

Header File :
#ifndef RESERVATION_H_  //to avoid redefinition errors

#include <iostream>
#include <string>
#include "Passenger.h"

using namespace std;

class Reservation{

	static int sn;//serial number 
    const string ID; //first two letters of passanger name plus sn
	bool smokerSeat;
	Passenger passenger;
	//Constructor taking the parameters of Passenger
	Reservation(string psngrName, long psngrPhone, string psngrPassport, bool 	smoke);
	//Constructor taking a Passenger object 
	Reservation(Passenger& psngr, bool smoke); 
	Passenger getPassenger();		
	bool isSmoker();// to check if the passenger is smoker or not  
	string getReservationNumber();	//getReservation number = getId 
	void printDetails(); // toprint passenger details
	string ID_sn();

#endif /*RESERVATION_H_*/

source File 
#include <string>
#include <iostream>
#include <sstream>
#include "reservation.h"
using namespace std;

//Constructor that initializes the data members to given parameters:
Reservation::Reservation(string psngrName, long psngrPhone, string psngrPassport, bool 	smoke)
}//end contsteuctor 

Reservation::Reservation(Passenger& psngr, bool smoke)
}//end consreuctor 

Passenger Reservation::getPassenger()
	return this->passenger;
}//end getPassenger Function

 bool Reservation::isSmoker()
	 return smokerSeat;
 }//end function isSmoker

void Reservation::printDetails() //function that print the user details 
    cout<< "passenger name: "<<passenger.getPassengerName();
	cout<<"passenger Contact Number:"<<passenger.getContactNumber();
	cout<<"Passenger Passport Number :"<<passenger.getPassportNumber();
	cout<<"passenger ID:"<<Reservation::getReservationNumber();
	cout<<" smoking preferences: "<<(isSmoker()?"smoker":"nonsmoker");
} //end function printDetails

i got this problem in the reservation.cpp
i cant change any thing in the header file all what i can change is on the cpp file
can any one help to solve this problem Confused | :confused:

this is line 44:

and in header file i have
string ID_sn();
function but im really confused how can i use it int the implementation file (source)
SuggestionRe: error C2678: binary '=' Pin
Maximilien13-Dec-12 8:00
memberMaximilien13-Dec-12 8:00 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 8:18
memberalaaan7313-Dec-12 8:18 
AnswerRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 8:30
memberChris Meech13-Dec-12 8:30 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 8:52
memberalaaan7313-Dec-12 8:52 
GeneralRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 9:17
memberChris Meech13-Dec-12 9:17 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 9:59
memberalaaan7313-Dec-12 9:59 
GeneralRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 10:06
memberChris Meech13-Dec-12 10:06 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 10:24
memberalaaan7313-Dec-12 10:24 
GeneralRe: error C2678: binary '=' Pin
Freak3014-Dec-12 1:48
memberFreak3014-Dec-12 1:48 
AnswerRe: error C2678: binary '=' Pin
Richard MacCutchan13-Dec-12 8:33
mvpRichard MacCutchan13-Dec-12 8:33 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 8:55
memberalaaan7313-Dec-12 8:55 
Questionprocess Pin
messages13-Dec-12 4:45
membermessages13-Dec-12 4:45 
AnswerRe: process Pin
DavidCrow13-Dec-12 5:14
memberDavidCrow13-Dec-12 5:14 
GeneralRe: process Pin
messages13-Dec-12 5:18
membermessages13-Dec-12 5:18 
Questionexporting data from C++ to C Pin
danielsutopo12-Dec-12 16:00
memberdanielsutopo12-Dec-12 16:00 
AnswerRe: exporting data from C++ to C Pin
Richard MacCutchan12-Dec-12 23:35
mvpRichard MacCutchan12-Dec-12 23:35 
GeneralRe: exporting data from C++ to C Pin
danielsutopo15-Dec-12 14:45
memberdanielsutopo15-Dec-12 14:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 16 Jan 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid