这个小程序有几个问题,帮忙找出来下说明原因好吗?
#include <iostream>
using namespace std;
class Student
{
private:
int num; //学号
public:
Student(); //默认构造函数
Student(int n); //构造函数
void show()const;
}
Student::Student()
{ //error: constructors not allowed a return type
num = 0;
}
Student::Student(int n)
{
num = n;
}
void show()const
{ //error: show:modifiers not allowed on nonmember functions
cout<<num;
}
int main()
{
Student s1;//error 怎么错了?
s1.show();
Student s2(1);
s2.show();
return 0;
}
using namespace std;
class Student
{
private:
int num; //学号
public:
Student(); //默认构造函数
Student(int n); //构造函数
void show()const;
}
Student::Student()
{ //error: constructors not allowed a return type
num = 0;
}
Student::Student(int n)
{
num = n;
}
void show()const
{ //error: show:modifiers not allowed on nonmember functions
cout<<num;
}
int main()
{
Student s1;//error 怎么错了?
s1.show();
Student s2(1);
s2.show();
return 0;
}
...全文
相关推荐
微信小程序在安卓的白屏问题原因及改进讲解
今天小编就为大家分享一篇关于微信小程序在安卓的白屏问题原因及改进讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
深入解析微信小程序开发中遇到的几个小问题
产品的简单介绍
微信小程序(找厕所例子)
微信小程序,请大家学习下载,本人也是初学 微信小程序,请大家学习下载,本人也是初学
串口通信关于串口找不到的问题
串口通信关于串口找不到的问题(我开始也被困扰了好久,终于解决,与大家分享一下)
小程序常见的审核不过的几个原因
1、微信小程序信息不够完善,比如小程序头像,介绍,栏目类目等... 2、开发的小程序里面的功能内容和小程序后台的名称 栏目不对应,或者完全无关联; 3、个人申请的小程序比企业或者个体工商户申请的小程序审核更加严格,涉及到商业的东西都不能通过; 4、开发的小程序里面的功能或者内容有出现“测试”,“未完成”等字样,如果出现了,微信审核人员会认为你的小程序是测试版本不给予通过! 5. 类目不完善...


