Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class base {
  4. protected:
  5. int b_;
  6. public:
  7. base(int b): b_(b) { cout << b_ * b_ << " "; }
  8. virtual void display() { }
  9. };
  10. class derived : public base {
  11. int d_;
  12. public:
  13. derived(int b, int d) : base(b), d_(d) { cout << d_ * d_ << " "; }
  14. void display();
  15. };
  16. class appObj {
  17. appObj(int x, int y) { cout << x + y << " " << endl; }
  18. ____________________ //what code should be filled
  19. }; // End of class "appObj"
  20. void derived::display() {
  21. derived obj1(b_, d_);
  22. }
  23. int main() {
  24. int m, n;
  25. cin >> m >> n;
  26. base *ptr = new derived(m, n);
  27. ptr->display();
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement