小白,c++自己编写的头文件中的类和函数怎样调用

2025-12-17 20:22:07
推荐回答(1个)
回答1:

包含头文件
然后创建类实例,通过实例调用函数

例如有个Student类在头文件Student.h里面,则
#include "Student.h"

Student s; //类实例
s.GetStudentName(); //通过实例调用函数