I'm trying to design a class to be able to accept various input and then return the values. Every time I build it, it complains about unknown override specifiers or unexpected tokens. I'm not sure if I'm failing to properly declare a variable or an include somewhere. Here's my code, some errors are commented in.
But this is a bad idea anyway, put std:: before each std thing, notice that all the expert coders here all do that. Google to see why.
Some things I noticed, mostly to do with style:
6 7 8 9 10 11 12 13 14 15 16 17 18
class Patient {
public:
Patient() = default; //does the same thing as what your code does - sets them all to zero.
Patient(string, int, int, double, int, string);
// provide names for the parameters & make them const, anything not POD use a reference
// not an error your way, but better this way
Patient(const std::string& Name,
constunsignedint AgeInYears,
constunsignedint HeightInches, // or cm, could use std::size_t, or something from cstdint.h
constdouble WeightPounds , // or Kg
constchar Gender,
const std::string& Disease);
With this, don't put the class name in the variable names, new is superfluous
19 20 21 22 23 24 25
private:
std::string Name;
int Age;
int Height;
double Weight;
int Gender;
std::string Disease;