Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class A
- {
- private:
- int x ;
- public:
- A(int X1)
- {
- x = X1 ;
- cout << "ALFA IS INITIALIZE" << endl;
- }
- void show_A()
- {
- cout << "X= " << x << endl;
- }
- };
- class B
- {
- private:
- float y ;
- public:
- B(float Y1)
- {
- y = Y1 ;
- cout << "BETA IS INITIALIZE!!" << endl;
- }
- void show_B()
- {
- cout << "Y= " << y << endl;
- }
- };
- class C : public A , public B
- {
- private :
- double z,w ;
- public:
- C(int a,float b,int c,int d) : A(a) , B(b)
- {
- z = a ;
- w = b ;
- }
- void show_z()
- {
- cout << "Z+W= " << z+w << endl;
- }
- }s(1,4.1,7,8);
- int main()
- {
- //C s(1,4.1,7,8) ;
- s.show_A();
- s.show_B();
- s.show_z();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement