Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class Base
  2. {
  3. public:
  4. virtual void SetValue(int v)
  5. {
  6. a = v;
  7. }
  8.  
  9. void SetValue(std::string str)
  10. {
  11. b = str;
  12. }
  13.  
  14. void SetValue(bool val)
  15. {
  16. c = val;
  17. }
  18.  
  19. private:
  20. int a;
  21. std::string b;
  22. bool c;
  23.  
  24. };
  25.  
  26.  
  27. class Derived : public Base
  28. {
  29. public:
  30. virtual void SetValue(int v) override
  31. {
  32. //
  33. }
  34. };
  35.  
  36.  
  37.  
  38.  
  39. int main()
  40. {
  41.  
  42. Derived d;
  43. d.SetValue("string"); // cant use string as argument
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement