daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top