fork(3) download
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. protected:
  6. A(std::string title, int xpos, int ypos);
  7. };
  8.  
  9. class B : A
  10. {
  11. protected:
  12. //Is that correct?
  13. A* m_pA(std::string title, int xpos, int ypos);
  14. //Why not just A* m_pA;?
  15. public:
  16. B(std::string title, int xpos, int ypos);
  17. };
  18.  
  19. B::B(std::string title, int xpos, int ypos, int width, int height) : m_pA(title,
  20. xpos, ypos)
  21. {
  22.  
  23. }
  24.  
  25. int main() {
  26.  
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:19:1: error: prototype for ‘B::B(std::string, int, int, int, int)’ does not match any in class ‘B’
 B::B(std::string title, int xpos, int ypos, int width, int height) : m_pA(title, 
 ^
prog.cpp:9:7: error: candidates are: constexpr B::B(B&&)
 class B : A
       ^
prog.cpp:9:7: error:                 constexpr B::B(const B&)
prog.cpp:16:2: error:                 B::B(std::string, int, int)
  B(std::string title, int xpos, int ypos);
  ^
stdout
Standard output is empty