Guest User

Untitled

a guest
Jan 22nd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. class A{
  3. public:
  4. void parse()
  5. {
  6. treatLine();
  7. };
  8. void treatLine()
  9. {
  10. std::cout << "treatLine in A" << std::endl;
  11. }
  12. };
  13.  
  14. class B : public A{
  15. public:
  16. void treatLine()
  17. {
  18. std::cout << "treatLine in B" << std::endl;
  19. }
  20. };
  21.  
  22. int main()
  23. {
  24. B b;
  25. b.parse();
  26. return 0;
  27. }
  28.  
  29. virtual void treatLine() {
  30. std::cout << "treatLine in A" << std::endl;
  31. }
Add Comment
Please, Sign In to add comment