I am new in c++ recently i started learning poo I want to create a class movies
and a class.
directors
a class movie
should have an array of directors
and I want to fill that array from the console. When I run the code it show me the first and second line and stop executing :
enter image description here
this is my code:
#include<iostream>
#include<string>
using namespace std;
class directors{
string name;
string lastname;
public:
directors(){
}
directors(string a,string b){
name=a;
lastname=b;
}
void createdirector(){
cout<<"name of director:"<<endl;
cin>>name;
cout<<"last name:"<<endl;
cin>>lastname;
}
};
class movie{
string name;
directors* director;
public:
film(){
directors* director=new directors[20];
};
void creatmovie(){
cout<<"name of movie"<<endl;
cin>>name;
director[0].createdirector();
}
};
int main(){
movie a;
a.creatmovie();
}