C++

构造函数类名与函数名相同,实际是函数将类实例化。

 

 

一个文件cpp中的main访问另一个文件cpp函数:

1建立.h文件 写类并将函数成员写入

class test {
public:
void test06();
};

2在另一文件中声明

void test::test06() {

3在main中实例化后,调用函数

test t;
t.test06();

posted @ 2023-03-07 16:04  cecel  阅读(28)  评论(0)    收藏  举报