【发布时间】:2013-09-28 11:02:37
【问题描述】:
我有两个文件
books.cpp and books.h
我在我的主要功能中使用这些类。 我在 main.cpp 文件中也有一个函数 func。
#include iostream
#include "books.h"
void func(int a, int b);
int main(){
books book;
func(5,6);
return 0;
}
void func(int a, int b){
//can i use the book object declared in main in this function?
}
我想要函数 main 中声明的 books 类对象 book 我如何访问它? 谁能帮帮我?
【问题讨论】:
标签: c++ function class variables