Would somebody mind looking at this code and giving me some advice as to the copy constructor and assignment operator overload function? When I try to use this class in my program, I get the following error:
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class Person *' (or there is no acceptable conversion)
header file:
[PHP]#ifndef Person_H
#define Person_H
// Class Name: Person
// Class Language: C++
// Class Filename: Person.h
class Person {
// Attributes:
private:
// private data members:
int ID;
int personCount;
int weight;
int waitTime;
// Operations:
public:
// public member functions:
Person();
~Person();
Person(const Person& aPerson);
Person &operator=(const Person &right);
void PersonLeavesBuilding();
};
#endif // Person_H [/PHP]
[PHP]#include
#include
#include "Person.h" // class header file
#include "building.h"
Given the class above (I did get the assignment overload to work), why would I be getting this error:
error C2228: left of '.personLeavesBuilding' must have class/struct/union type
on this piece of code?
[PHP]
void Elevator::passengerExits(Floor* bFloors) {
if(floorNumRef==0) {
for(int i=0; i