samedi 30 octobre 2021

Getting a warning when I use a class within a class in C++ [closed]

#include <iostream>
#include <string>
#include <fstream>
#include <vector>

using namespace std;


class Course{

  public:
  string name;
  int pars[];
  Course();

};

class Runs{

  public:
  Course course; <- Error
  int scores[];
  Runs();

};

I am trying to use the classes to read lines from a badly formatted file. Why can't I use a class within a class?

Aucun commentaire:

Enregistrer un commentaire