How do I initialize dvd1?
C:\Users\SuperUser\Google Drive>g++ -o a Question1.cpp
Question1.cpp: In function 'int main()':
Question1.cpp:39:76: error: in C++98 'dvd1' must be initialized by constructor, not by '{...}'
dvd dvd1 = {"Zombie","BBC","James","English","Alw",2012,20170601,20170630};
#include <iostream>
#include <string>
using namespace std;
class dvd
{
string movieName,movieProdComp,movieLeadActor,movieLanguage,renterName;
int releaseYear,rentDate,returnDate;
public:
dvd(string mn,string mpc,string mla,string ml, string rn,int ry,int rd,int retd);
void print();
};
dvd::dvd(string mn,string mpc,string mla,string ml, string rn, int ry,int rd,int retd){
movieName=mn;
movieProdComp=mpc;
movieLeadActor=mla;
movieLanguage=ml;
renterName=rn;
releaseYear=ry;
rentDate=rd;
returnDate=retd;
}
void dvd::print(){
cout<<"Movie:"<<movieName<<endl;
cout<<"Production:"<<movieProdComp<<endl;
cout<<"Starring:"<<movieLeadActor<<endl;
cout<<"Language:"<<movieLanguage<<endl;
cout<<"Rented By:"<<renterName<<endl;
cout<<"Released:"<<releaseYear<<endl;
cout<<"Rent Date:"<<rentDate<<endl;
cout<<"Return Date:"<<returnDate<<endl;
}
int main(){
dvd();
dvd dvd1 = {"Zombie","BBC","James","English","Alw",2012,20170601,20170630};
dvd1.print();
}