ALL


  A C++ program puzzle

Recently I came across a question asked by wang2191195 on a Chinese IT forum CSDN which asks about a C++ program puzzle. He has a code snippet which cannot be compiled. The code is:#include <cstdlib>#include <iostream>using namespace std;class Base{public: virtual void func(){ cout << "Base::func()" << endl; } virtual int func( int num ){ cout << "Base::func( int " << num << " )" << endl; return 0; }};class Derived : public Base{public: virtual void func(){ cout << "Derived::func()" << endl; ...

11,548 4       C++ OVERLOAD PUZZLE HIDE


  "Programmer" is an Overgeneralization

"Beware of bugs in the above code; I have only proved it correct, not tried it." - Donald KnuthEarlier today, I came across a post during a google-fu session that claimed that no one should use the C++ standard library function make_heap, because almost nobody uses it correctly. I immediately started mentally ranting about how utterly ridiculous this claim is, because anyone whose gone to a basic algorithm class would know how to properly use make_heap. Then I started thinking about all the programmers who don't know what a heap is, and furthermore probably don't even need to know.Then I reali...

3,935 0       PROGRAMMER OVERLOAD OVERGENERATION