Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class base {
- protected:
- int b_;
- public:
- base(int b): b_(b) { cout << b_ * b_ << " "; }
- virtual void display() { }
- };
- class derived : public base {
- int d_;
- public:
- derived(int b, int d) : base(b), d_(d) { cout << d_ * d_ << " "; }
- void display();
- };
- class appObj {
- appObj(int x, int y) { cout << x + y << " " << endl; }
- ____________________ //what code should be filled
- }; // End of class "appObj"
- void derived::display() {
- derived obj1(b_, d_);
- }
- int main() {
- int m, n;
- cin >> m >> n;
- base *ptr = new derived(m, n);
- ptr->display();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement