Advertisement
Imran1107048

Multiple Inheritance for Square & Cube

Apr 19th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class square
  5. {
  6. public:
  7. int a=3;
  8. square()
  9. {
  10. a=a*a;
  11. cout << "Square is: " << a << endl;
  12. }
  13. };
  14. class cube
  15. {
  16. public:
  17. int a=3;
  18. cube()
  19. {
  20. a=a*a*a;
  21. cout << "Cube is: " << a << endl;
  22. }
  23. };
  24.  
  25. class number : public square , public cube
  26. {
  27.  
  28. };
  29.  
  30. int main()
  31. {
  32. number obj;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement