There are two class.How can I initialize an array of different class in a constructor?
class Ticket{
private:
int ID;
double price;
bool available;
int getID();
double getPrice();
};
class Cinema{
private:
Ticket ticket[50];
public:
Cinema();
double purchaseTicket(int);
void listAll();
};
Both classes are given.
I have to provide a no-argument constructor (Cinema();)to initialize the ticket array and give the right ticket ID.
you don't need to initialize the ticket class inside the cinema, just initialize ticket in it's own class as you want and it will get initialized automatically when you create an object of cinema