【发布时间】:2011-11-01 06:30:10
【问题描述】:
我想在 C++ 类中封装一个 C 库。对于我的 C++ 类,我也希望这些 C 函数使用相同的声明:可以这样做吗?
例如,如果我有以下情况,如何区分 C 函数和 C++ 函数?我想把 C 称为偏离路线。
extern int my_foo( int val ); //
class MyClass{
public:
int my_foo( int val ){
// what to write here to use
// the C functions?
// If I call my_foo(val) it will call
// the class function not the global one
}
}
【问题讨论】: