Abr*_*ile 32 c++ gcc word-wrap
我想在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
}
}
Run Code Online (Sandbox Code Playgroud)
Ada*_*eld 54
使用范围解析运算符:::
int my_foo( int val ){
// Call the global function 'my_foo'
return ::my_foo(val);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14882 次 |
| 最近记录: |