易截截图软件、单文件、免安装、纯绿色、仅160KB

初始化函数中的虚函数调用( C++ vs python )

代码+结果,不做解释
当然,对于python没有virtual function一说,估计当作对比一个例子看看吧。
#include <iostream>
using namespace std;
class base
{
public:
virtual void foo() { cout << "base" << endl; }
base() { foo() ;}
};
class derive: public base
{
public:
derive() { foo(); }
virtual void foo() { cout << "derive" << endl; }
};
int main()
{
derive d;
return 0;
}

结果:
base
derive
class base(object):
def __init__( self ):
self.foo()
def foo( self ):
print "base"
class derive( base ):
def __init__( self ):
super( derive , self ).__init__()
self.foo()
def foo( self ):
print "derive"
d = derive()

结果:
derive
derive


相关文档:

转载:Hadoop 应该用C++实现,而不是Java

http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......

用python实现crc32求字符串校验码


转帖:
http://blog.csdn.net/wyingquan/archive/2008/12/20/3561094.aspx
用python自带的binascii模块计算字符串的校验码,出来的是负值,与用c写的程序得出的校验码不一样,所以就研究了一下。发现别人用的python3.0版本binascii模块计算出的crc32校验码是我想要的,没办法只好自己用python实现一下crc32的算法了。发 ......

C/C++函数的借口定义

1、在C文件中调用C++文件中定义的文件
直接的方法是在C++ 文件的头部添加如下代码段:
extern "C"
{
      int API(int A);
}
2、C++接口的方法
在C++中调用C的函数,在C头文件中加入如下代码:
#ifdef __cplusplus          // 开始
exte ......

memcachde 与 c/c++ 应用

修改makefile,在LIBS里面加上-lmemcached,比如原来 gcc test.c,现在 gcc test.c -lmemcached。这个库就是libmemcached提供的。
然后添加#include<libmemcached/memcached.h>,这个文件也是libmemcached提供的。
主函数里面需要添加:
    memcached_st *memc;
    uint32_t&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号