Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <string>
- class A
- {
- };
- class B
- {
- };
- class C
- {
- public:
- C(const std::string& inS);
- C(const std::string& inS, A* inA);
- virtual ~C();
- };
- class D : public virtual C, public virtual B
- {
- public:
- D(const std::string& inS, B* inB)
- :
- C(inS)
- {
- }
- };
- class E : public virtual D, public virtual A
- {
- public:
- E(const std::string& inS, B* inB)
- :
- D(inS, inB)
- {
- }
- };
- -----------------
- Why does the above code get this error:
- $ clang Test.cpp
- Test.cpp:40:5: error: constructor for 'E' must explicitly initialize the base class 'C' which does not have a default constructor
- E(const std::string& inS, B* inB)
- ^
- Test.cpp:12:7: note: 'C' declared here
- class C
- ^
- 1 error generated.
Advertisement
Add Comment
Please, Sign In to add comment