- 论坛徽章:
- 0
|
有3个文件,student.h,student.cpp,main.cpp.其中student.cpp include了student.h,为什么main.cpp只需要include student.h就可以了?
我反而觉得main.cpp只需要include student.c就可以了,因为student.c包含了student.h,这样所有的关系都联系起来了.
/*********************************************************************************
student.h
*********************************************************************************/
class Student
{
Student();
int f();
//................
};
/*********************************************************************************
student.cpp
*********************************************************************************/
#incude "student.h"
Student::Student()
{
//................
}
int Student::f()
{
//.............
}
/*********************************************************************************
main.cpp
*********************************************************************************/
#include"student.h" //个人觉得#include"student.c" 才对
void main()
{
Student s;
//.....................
} |
|