C++程序
Joyce--
这个作者很懒,什么都没留下…
展开
-
C++运算符、继承
一、C++运算符重载“==”①不允许用户自定义新的运算符,只能对已有的运算符进行重载②重载运算符不能改变运算符操作数的个数③不能改变运算符的优先级④不能改变运算符的结合性⑤不能有默认的参数#include<iostream>using namespace std;class CStudent{ private: string pname; int page; public: CStudent(string name,int age)原创 2022-04-19 16:11:01 · 320 阅读 · 0 评论 -
C++类练习(一)
有这么个需求,所有的在校生都必须有学号,所以能不能实现实例化一个Student对象之后,就要求输入学号,不存在一个没有学号的Student对象被实例化出来,大家明白了吗?也就是类似于 stud1 这样的对象是不允许存在的,因为其没有学号。#include<iostream>#include<string.h>using namespace std;class Cstudent{ public: char name[50]; char sex.原创 2022-04-07 11:45:09 · 893 阅读 · 0 评论