As OriginalGriff wrote, a header(.h) should only contain declarations and constants.
Only the declaration of the class would then be found in the header.
It looks something like this:
...
class movieList
{
public:
movieList(int movieCode, string movieTitle, string movieGenre, int yearReleased);
int GetmovieCode() { return movieCode; }
string GetmovieTitle() { return movieTitle; }
string GetmovieGenre() { return movieGenre; }
int GetyearReleased() { return yearReleased; }
private:
int movieCode;
string movieTitle;
string movieGenre;
int yearReleased;
};
class moviesLL
{
public:
moviesLL() {};
int menu();
void insertMovie();
void deleteMovie();
void appendMovie();
void appendMovie(int movieCode, string movieTitle, string movieGenre, int yearReleased);
void showMovieDetails();
void printMovieList();
void deleteMovieList();
private:
list<movieList> movies;
};
The implementation, i.e. the associated code, then belongs in the Data.cpp file.
#include "data.h"
movieList::movieList(int movieCode, string movieTitle, string movieGenre, int yearReleased)
{
this->movieCode = movieCode;
this->movieTitle = movieTitle;
this->movieGenre = movieGenre;
this->yearReleased = yearReleased;
};
void moviesLL::deleteMovieList()
{
movies.clear();
}
...
A test program could then look like this:
#include "data.h"
int main() {
moviesLL m;
m.appendMovie(1234, "Just do it", "Science", 2022);
m.printMovieList();
return 0;
}