摘要: 转自:http://blog.csdn.net/lf8289/article/details/2322550在python中调用dll文件中的接口比较简单,实例代码如下:如我们有一个test.dll文件,内部定义如下:extern"C"{int__stdcalltest(void*p,intlen){returnlen;}}在python中我们可以用以下两种方式载入1.importctypesdll=ctypes.windll.LoadLibrary('test.dll')2.importctypesdll=ctypes.WinDll('test.d 阅读全文
posted @ 2012-12-21 20:21 fff8965 阅读(1381) 评论(0) 推荐(0) 编辑
摘要: const char *cs = typeid(*point).name();上面的代码可以获得指针指向的类的类型名下面的代码判断某个指针指向的实例是否是某个类的实例,相当于java的instanceof#include <iostream> using namespace std; class A{ virtual void f(){};}; class B: public A{}; int main(){ A *a = new B; if (typeid(*a) == typeid(B)) { cout << "a is pointed to B... 阅读全文
posted @ 2012-12-21 02:07 fff8965 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.sf.org.cn/Article/base/200805/21024.html多态性 (polymorphism) 是面向对象编程的基本特征之一。而在 C++ 中,多态性通过虚函数 (virtual function) 来实现。我们来看一段简单的代码: #include <iostream> using namespace std; class Base { int a; public: virtual void fun1() {cout<<"Base::fun1()"<<endl;} virtual voi 阅读全文
posted @ 2012-12-21 02:00 fff8965 阅读(298) 评论(0) 推荐(0) 编辑