#pragma once
#include <iostream>
using namespace std;
class Student;
ostream& operator<<(ostream& os , const Student& other);//函数成员重载
class Student
{
public:
~Student();
Student();
Student(int age_,const char* name);//自定义构造函数
void print();
private:
int age;
char *name;
Student& operator=(const Student& other);//赋值构造函数
friend ostream& operator<< (ostream& os, const Student& other);//友元函数实现对<<符的重载,可以cout输入对象
};
___________________________华丽的分割线______________________________
#include "Student.h"
#include <stdlib.h>
Student::~Student()
{
delete[] name;
name = NULL;
}
Student::Student()
{
this->age = 0;
this-&