初始化函数中的虚函数调用( 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
相关文档:
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, ......
C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick
Share | ......
没有必要用一堆绕口的形容词来描述什么叫多态,只举出几个关键点。
设:gun为父类,shootgun和pistol为gun的子类。
Java:
class gun {
void shoot() {
  ......
// & 与,将指定位置设置为0 | 或,将指定位置设置为1
//注: 只针对纯字母的情况
#include <stdio.h>
#include <string>
int main()
{
char str[6] = "xxing";
std::string str1 = "INGXX";
for(int i = 0; i < 5; i++)
{
str[i] &= 0xdf; ......
Memcached
是danga.com(运营LiveJournal的技术团队)开发的一套分布式内存对象缓存系统,用于在动态系统中减少数据库负载,提升性能。
网上有很多讲到Memcached For Linux的安装教程,但是Memcached For Win32 and Python的就甚少,偶尔google找到一篇
比较相近的英文教程,觉得 ......