Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cassert>
  3.  
  4. class A {
  5. public:
  6. int f () {
  7. return 5;
  8. }
  9. int g () {
  10. return f() * f();
  11. }
  12. };
  13.  
  14. class B:A {
  15. public:
  16. int f () {
  17. return 6;
  18. }
  19. };
  20.  
  21.  
  22. int main () {
  23. assert(B().g() == 36);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement