'No matching Constructor Error For Initialization in c++. Whats wrong with my constructor?
I have a class in a header file as follows:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class ShowTicket {
public:
bool is_sold(void){
if (sold_status == true){
return true;
}
else{
return false;
}
}
void sell_seat(void){
sold_status = true;
}
string print_ticket(void){
ostringstream sout;
if(sold_status == true){
sout<<row<<" "<<seat_number<<"sold";
}
else{
sout<<row<<" "<<seat_number<<"available";
}
return sout.str();
}
bool sold_status;
const char* row;
const char* seat_number;
ShowTicket(const char* Row, const char* SeatNumber):
sold_status{false},
row(Row),
seat_number(SeatNumber)
{}
};
The main function to test this class is as follows:
#include <iostream>
#include <string>
#include <sstream>
#include "showticket.h"
using namespace std;
int main () {
ShowTicket myticket1("AA","101");
ShowTicket myticket2("AA","102");
if(!myticket1.is_sold())
myticket1.sell_seat ();
cout << myticket1.print_ticket() << endl;
cout << myticket2.print_ticket() << endl;
return 0;
}
When myticket 1 and 2 are created there is an error "No matching constructor for initialization of 'ShowTicket" but I believe my constructor accepts these parameters so I'm not sure how to resolve.
Any advice would be appreciated.
Solution 1:[1]
jQuery's prev method will return the array of previous siblings of the elements matching .not('#r2').
.not('#r2') will return [audio#r1.r, audio#r4.r, audio#r5.r, audio#r6.r].
.not('#r2').prev() will return [audio#r2.r, audio#r4.r, audio#r5.r].
This is :
#r1previous sibling will return none#r4previous sibling will be#r2#r5previous sibling will be#r4#r6previous sibling will be#r5
If what you want is to play only the previous sibling to #r2 you should use a more deterministic selector. something like $("audio#r2").prev().get(0).play() may be?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fmquaglia |
