C++无法将参数1从const char[5]转换为char
发布时间
阅读量:
阅读量
在C语言中文网的C++静态成员函数相关教程中,遇到了一个关于参数类型转换的问题,具体表现为无法将“const char[5]”类型参数转换为“char”类型,最终通过自身努力成功解决了该问题,现将此过程记录下来,期望对遇到相同问题的学习者或未来需要查阅此内容的人有所帮助。
示例代码如下
#include <iostream>
using namespace std;
class Student {
public:
Student(char *name, int age, float score);
void show();
public: //声明静态成员函数
static int getTotal();
static float getPoints();
private:
static int m_total; //总人数
static float m_points; //总成绩
private:
char *m_name;
int m_age;
float m_score;
};
int Student::m_total = 0;
float Student::m_poi
全部评论 (0)
还没有任何评论哟~
