Click here to Skip to main content
15,440,714 members
Home / Discussions / C / C++ / MFC

C / C++ / MFC

QuestionGraphics Interface (game) Pin
April Fans13-Dec-12 18:37
MemberApril Fans13-Dec-12 18:37 
AnswerRe: Graphics Interface (game) Pin
Richard MacCutchan13-Dec-12 22:40
mveRichard MacCutchan13-Dec-12 22:40 
GeneralRe: Graphics Interface (game) Pin
April Fans20-Dec-12 19:13
MemberApril Fans20-Dec-12 19:13 
QuestionCompilation Problem Pin
BobInNJ13-Dec-12 14:15
MemberBobInNJ13-Dec-12 14:15 
AnswerRe: Compilation Problem Pin
Graham Breach13-Dec-12 21:58
MemberGraham Breach13-Dec-12 21:58 
GeneralRe: Compilation Problem Pin
BobInNJ14-Dec-12 11:16
MemberBobInNJ14-Dec-12 11:16 
GeneralRe: Compilation Problem Pin
Graham Breach14-Dec-12 23:31
MemberGraham Breach14-Dec-12 23:31 
Questionerror C2678: binary '=' Pin
alaaan7313-Dec-12 6:41
Memberalaaan7313-Dec-12 6: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 7:00
MemberMaximilien13-Dec-12 7:00 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 7:18
Memberalaaan7313-Dec-12 7:18 
AnswerRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 7:30
MemberChris Meech13-Dec-12 7:30 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 7:52
Memberalaaan7313-Dec-12 7:52 
GeneralRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 8:17
MemberChris Meech13-Dec-12 8:17 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 8:59
Memberalaaan7313-Dec-12 8:59 
GeneralRe: error C2678: binary '=' Pin
Chris Meech13-Dec-12 9:06
MemberChris Meech13-Dec-12 9:06 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 9:24
Memberalaaan7313-Dec-12 9:24 
GeneralRe: error C2678: binary '=' Pin
Freak3014-Dec-12 0:48
MemberFreak3014-Dec-12 0:48 
AnswerRe: error C2678: binary '=' Pin
Richard MacCutchan13-Dec-12 7:33
mveRichard MacCutchan13-Dec-12 7:33 
GeneralRe: error C2678: binary '=' Pin
alaaan7313-Dec-12 7:55
Memberalaaan7313-Dec-12 7:55 
Questionprocess Pin
messages13-Dec-12 3:45
Membermessages13-Dec-12 3:45 
AnswerRe: process Pin
David Crow13-Dec-12 4:14
MemberDavid Crow13-Dec-12 4:14 
GeneralRe: process Pin
messages13-Dec-12 4:18
Membermessages13-Dec-12 4:18 
Questionexporting data from C++ to C Pin
danielsutopo12-Dec-12 15:00
Memberdanielsutopo12-Dec-12 15:00 
AnswerRe: exporting data from C++ to C Pin
Richard MacCutchan12-Dec-12 22:35
mveRichard MacCutchan12-Dec-12 22:35 
GeneralRe: exporting data from C++ to C Pin
danielsutopo15-Dec-12 13:45
Memberdanielsutopo15-Dec-12 13: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.