我想访问座位[row] [col] .getFirstName,但是使用以下代码我得到一个错误,并且在if条件下strcmp中的相同错误可以解释它是什么意思
错误C3867'Guest :: getFirstName':非标准语法;使用'&'至 创建指向成员的指针
Auditorium.cpp
array[i]
Auditorium.h
Auditorium::Auditorium(int rowNum, int columnNum) {
rowNum1 = rowNum;
columnNum1 = columnNum;
Guest** seating =new Guest*[rowNum];
for (int i = 0; i < rowNum; i++)
{
seating[i] = new Guest[columnNum];
Guest();
}
}
bool Auditorium::assignGuestAt(int row,int col, Guest* tempGuest){
if ((strcmp(seating[row][col].getFirstName ,"???")==0)&& (strcmp(seating[row][col].getLastName , "???")==0)) \\ error
{
for (int i = 0; i < row; i++)
{
seating[row][col].getFirstName= tempGuest->getFirstName;\\ error
seating[row][col].getLastName = tempGuest->getLastName;\\ error
return 1;
}
}
else {
return 0;
}
}
guest.cpp
#include<iostream>
#include "guest.h"
using namespace std;
class Auditorium
{
private:
Guest **seating;
public:
Auditorium(int, int);
Guest* getGuestAt(int, int);
bool assignGuestAt(int, int, Guest *);
bool checkBoundaries(int, int);
void toString();
};