fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. class Tiles {
  6. public:
  7. void AddTile(int x) { tiles_.push_back(x); }
  8. std::vector<int> tiles_;
  9. };
  10.  
  11. class TilesWithData : public Tiles {
  12. public:
  13. void AddTile(int x, double data) {
  14. tiles_.push_back(x);
  15. data_.push_back(data);
  16. }
  17. std::vector<double> data_;
  18. };
  19.  
  20. int main() {
  21. Tiles a;
  22. a.AddTile(10);
  23.  
  24. TilesWithData b;
  25. b.AddTile(20, 12.5);
  26. b.AddTile(30);
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:26:14: error: no matching function for call to ‘TilesWithData::AddTile(int)’
  b.AddTile(30);
              ^
prog.cpp:13:8: note: candidate: void TilesWithData::AddTile(int, double)
   void AddTile(int x, double data) {
        ^~~~~~~
prog.cpp:13:8: note:   candidate expects 2 arguments, 1 provided
stdout
Standard output is empty