私は初めてでc++
、コンストラクターとクラスに問題があります。だから、これが私のヘッダーファイルです:
#pragma once
#include <string>
using namespace std;
class test
{
private:
string name;
int number;
public:
test();
test(string i,int b);
};
これはcppファイルです:
#include "test.h"
#include <string>
using namespace std;
test::test(){}
test::test(string i,int b){
this->name=i;
this->number=b;
}
今、私が電話しようとすると
test t=new test("rrr",8);
私は得る:
1 IntelliSense: no suitable constructor exists to convert from "test *" to "test"
では、*
名前にクラスが含まれているとどうなりますか(たとえば、.cppファイルのないクラスにはアステリックスがありませんが、他のすべてのクラスにはアステリックスがあります)。そして、私は何を間違えますか?