+ 9

how to solve this program

#include <iostream> using namespace std; class base { protected: int a; public: int b; __________ //LINE 1 base(int x, int y): a(x), b(y) { } ~base() { } void callme(int i, int j) { a = i; b = j; cout << a << b; } }; class derived : public base { protected: int c; public: int d; __________ //LINE 2 derived(int x, int y): c(x), d(y) { a = b = 0; } ~derived() { } void callme() { cout << endl << a << endl << b; } }; class dderived :public derived { protected: int e; public: int f; __________ //LINE 3 dderived(int x, int y): e(x), f(y) { a = b = c = d = 0; } ~dderived() { } void callme() { cout << endl << a << endl << b << endl << c << endl << d; } }; class ddderived : protected dderived { private: int g, sum; public: int h; ddderived(int x, int y): g(x), h(y) { a = 3 * g; b = 3 * h; c = 3 * a; d = 3 * b; e = 3 * c; f = 3 * d; } ~ddderived() { } void callme() { sum = a + b + b + c + d + e + f; cout << sum; } }; int main() { base b1; derived d1; dderived d2; int q, r; cin >> q >> r; ddderived d3(q, r); d3.callme(); return 0; }

2nd Mar 2019, 5:46 PM
Jayashree Janani.P
Jayashree Janani.P - avatar
8 ответов
+ 5
Sry post deleted Answers Line 1=base(){} Line 2=derived(){} Line 3=dderived(){}
9th Mar 2019, 5:57 AM
Esakkidevi G
Esakkidevi G - avatar
+ 11
Wow Esakki well done
8th Mar 2019, 12:13 PM
Jayashree Janani.P
Jayashree Janani.P - avatar
+ 7
sorry can't understand
4th Mar 2019, 2:02 PM
Jayashree Janani.P
Jayashree Janani.P - avatar
+ 7
Its ok Esakki
9th Mar 2019, 1:33 PM
Jayashree Janani.P
Jayashree Janani.P - avatar
+ 6
fill in the blanks with constructor
5th Mar 2019, 10:19 AM
Jayashree Janani.P
Jayashree Janani.P - avatar
+ 3
A perfect mindset!
4th Mar 2019, 3:08 PM
Imran Alam
Imran Alam - avatar
+ 1
#include <iostream> using namespace std; class base { protected: int a; public: int b; __________ //LINE 1 base(int x, int y): a(x), b(y) { } ~base() { } void callme(int i, int j) { a = i; b = j; cout << a << b; } }; class derived : public base { protected: int c; public: int d; __________ //LINE 2 derived(int x, int y): c(x), d(y) { a = b = 0; } ~derived() { } void callme() { cout << endl << a << endl << b; } }; class dderived :public derived { protected: int e; public: int f; __________ //LINE 3 dderived(int x, int y): e(x), f(y) { a = b = c = d = 0; } ~dderived() { } void callme() { cout << endl << a << endl << b << endl << c << endl << d; } }; class ddderived : protected dderived { private: int g, sum; public: int h; ddderived(int x, int y): g(x), h(y) { a = 3 * g; b = 3 * h; c = 3 * a; d = 3 * b; e = 3 * c; f = 3 * d; } ~ddderived() { } void callme() { sum = a + b + b + c + d + e + f; cout << sum; } }; int main() { base b1; derived d1; dderived d2; int q, r; cin >> q >> r; ddderived d3(q, r); d3.callme(); return 0; }
5th Mar 2019, 12:02 AM
Mohammad bahrami
Mohammad bahrami - avatar