我一直在寻找几个小时试图弄清楚我做错了什么,而且我已经摆脱了我的大多数问题但是当我尝试编译我的代码时,main()
它会出现同样的错误信息:
request for member "..." in "..." which is of non-class type "..."
Run Code Online (Sandbox Code Playgroud)
它会重复我尝试调用的所有函数main()
.问题是什么?我无法弄清楚我的错误在哪里.
我在macbook上使用Terminal来编译代码.
这是我的主要功能:
//Program1.cpp
//Program1Math test function
#include "Program1Math.h"
int main()
{
//Create a Program1Math object
Program1Math myProgram1Math();
myProgram1Math.setNumber1();
myProgram1Math.setNumber2();
myProgram1Math.displayMultiple();
myProgram1Math.displaySine1();
myProgram1Math.displayTangent1();
myProgram1Math.displaySine2();
myProgram1Math.displayTangent2();
}
Run Code Online (Sandbox Code Playgroud)
以下是该类的成员函数定义:
//Program1Math.cpp
//Program1Math member-function definitions.
#include <iostream>
#include <cmath>
#include "Program1Math.h"
using namespace std;
//constructor makes a Program1Math, adds an blank line
Program1Math::Program1Math()
{
cout << "/n";
}
//function to assign the first integer to its appropriate …
Run Code Online (Sandbox Code Playgroud)