#include <iostream>
#include <string>
using namespace std;
class Dog{
private:
int age;
string name;
public:
Dog(int a, string x){ //constructor
age = a;
name = x;
};
string getName(){
return name;
};
int getAge(){
return age;
};
};
int main(){
Dog(10, "fid0") ben;
cout<< ben.getName();
return 0;
}
我无法使用自定义讲师实例化的班级有什么问题?我对cpp还是陌生的,无法弄清原因。我无法弄清楚为什么有时我的Dog对象有时被视为指针。资源将不胜感激
更改