Hi at this part of the code at the default constructor
codedateInception = 0;
dateDeath = NULL:
location = 0;
I get errors and I know its because they are of a class. I don't know how to set it up to have values. Any help?
Header File
#ifndef ACTOR_H_
#define ACTOR_H_
#include "Point3D.h"
#include "Date.h"
#include <iostream>
using namespace std;
class Actor{
public:
Actor();
string getName() const;
double getMaxSpeed() const;
int getWeight() const;
int getHeight() const;
double getTendency() const;
Date getInception() const;
Date getDeath() const;
Point3D getLocation() const;
bool validityWeight(int testWeight);
bool validityHeight(int testHeight);
bool validityTendency(int testTendency);
string getCharacteristics();
private:
string name;
double maxSpeed;
double tendency;
int height;
int weight;
Date dateInception;
Date dateDeath;
Point3D location;
bool test;
};
#endif /* ACTOR_H_ */
Actor Method file
#include "Actor.h"
#include "Point3D.h"
#include "Date.h"
#include <iostream>
#include <sstream>
using namespace std;
Actor::Actor(){
test = false;
name = "unknown";
maxSpeed = 0;
height = 0;
weight = 0;
tendency = 0;
dateInception = 0;
dateDeath = NULL:
location = 0;
}
//returns name of type string
string Actor::getName() const{
return name;
}
//returns maxSpeed of type double
double Actor::getMaxSpeed() const{
return maxSpeed;
}
//returns weight of type integer
int Actor::getWeight() const{
return weight;
}
//returns height of type integer
int Actor::getHeight() const{
return height;
}
//returns tendency of type double
double Actor::getTendency() const{
return tendency;
}
//returns dateInception of type Date
Date Actor::getInception() const{
return dateInception;
}
//returns dateDeath of type Date
Date Actor::getDeath() const{
return dateDeath;
}
//returns location of type Point3D
Point3D Actor::getLocation() const{
return location;
}
//tests and sets the value of the individual's tendency
bool Actor::validityTendency(int testTendency){
if(testTendency == -1 || testTendency == 1){
tendency = testTendency;
test = true;
}
else
test = false;
return test;
}
//tests and sets the value of the individual's height
bool Actor::validityHeight(int testHeight){
if(testHeight <= 1000 && testHeight >= 0){
height = testHeight;
test = true;
}
else
test = false;
return test;
}
//test and sets the value of the individual's weight
bool Actor::validityWeight(int testWeight){
if(testWeight <= 1000 && testWeight >= 0){
weight = testWeight;
test = true;
}
else
test = false;
return test;
}
string Actor::getCharacteristics(){
//Uses get function to return the values of Actor members
tendency = getTendency();
height = getHeight();
weight = getWeight();
maxSpeed = getMaxSpeed();
name = getName();
dateInception = getInception();
dateDeath = getDeath();
location = getLocation();
string brackets = "/";
//Opens a stringstream and allows integerss to be displayed as a string
stringstream out;
string dateString;
//stores integers and strings into a string out stream
out << name << brackets << height << brackets << weight << brackets << tendency;
//displays the string using the command out instead of cout
out >> dateString;
return dateString;
}