Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. private:
  7. int x ;
  8. public:
  9. A(int X1)
  10. {
  11. x = X1 ;
  12. cout << "ALFA IS INITIALIZE" << endl;
  13. }
  14. void show_A()
  15. {
  16. cout << "X= " << x << endl;
  17. }
  18. };
  19.  
  20. class B
  21. {
  22. private:
  23. float y ;
  24. public:
  25. B(float Y1)
  26. {
  27. y = Y1 ;
  28. cout << "BETA IS INITIALIZE!!" << endl;
  29. }
  30. void show_B()
  31. {
  32. cout << "Y= " << y << endl;
  33. }
  34. };
  35.  
  36. class C : public A , public B
  37. {
  38. private :
  39. double z,w ;
  40. public:
  41. C(int a,float b,int c,int d) : A(a) , B(b)
  42. {
  43. z = a ;
  44. w = b ;
  45. }
  46. void show_z()
  47. {
  48. cout << "Z+W= " << z+w << endl;
  49. }
  50. }s(1,4.1,7,8);
  51.  
  52. int main()
  53. {
  54. //C s(1,4.1,7,8) ;
  55. s.show_A();
  56. s.show_B();
  57. s.show_z();
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement