I'm testing this code and wondering why this wasn't failed at compile time ?. I'm using c++11 and g++ 4.7.2.
I had similar structure on my production code, it was giving errors at run time, then I found that I'm constructing the class with wrong argument type.
#include <iostream>
#include <vector>
typedef std::vector<std::string> Word;
class Data {
    public:
        const Word &word;
        Data(Word w) : word(w) {}
};
class Base{
    const Data &data;
    public:
        Base(const Data &d): data(d) {}
        ~Base() {}
};
class Work : public Base{
    public:
        Work(const Data &d): Base(d){}
        ~Work() {}
};
int main(int argc, char **argv){
    Word words;
    words.push_back("work");
    /*
    * I'm confused with this constructor, why this passed the compilation
    * ??
    * Any special rule to reason this scenario ??
    *
    * But obviously it will fail at run time.
    */
    const Work *work  = new Work(words);
    return 0;
}
 
     
     
     
    