【问题标题】:C++ code not workingC++ 代码不工作
【发布时间】:2016-01-29 00:00:21
【问题描述】:

这是我的代码。为什么找不到“第一”?

.h 文件

/*
 * Student.h
  *
  *  Created on: Jan 28, 2016
 *      Author: Clint Sullivan
 */

#ifndef STUDENT_H_
#define STUDENT_H_

#include <iostream>
#include <string>


using namespace std;



class Student {

struct Address{
    string street;
    string city;
    string state;
    string zipcode;     
};

private:
int eid;
string first;
string last;
Address campusAddress;
Transcript transcript;

public:

Student();

int getEID() const;
string getFirst() const;
string getLast() const;
Address getCampusAddress() const;
Transcript getTranscript() const;

void setEid(const int eid);
void setFirst(const string& first);
void setLast(const string& last);
void setCampusAddress(const Address& campusAddress);
void setTranscript(const Transcript& transcript);
string toString() const;


};



/* namespace std */

#endif /* STUDENT_H_ */

.cpp 文件:

/*
  * Student.cpp
 *
 *  Created on: Jan 28, 2016
 *      Author: Clint Sullivan
  */
#include <sstream>
#include "Student.h"


using namespace std;

struct Address;

Student::Student()
{

}

string Student::getFirst() const {return first; } //member declaration not found, symbol 'first' could not be resolved

有什么建议吗?

【问题讨论】:

标签: c++


【解决方案1】:

您在 Student 类的私有部分定义了一个 Transcipt 类型变量,但我看不到您在哪里定义了成绩单结构/类?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多