Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class A{
  6. public:
  7.     int m_a;
  8.  
  9. public:
  10.     A(int a): m_a(a){
  11.         cout << "A class " << m_a;
  12.     }
  13. };
  14.  
  15. class B: public A{
  16. public:
  17.     int m_b;
  18.  
  19. public:
  20.     B(int a,int b): A(a), m_b(b){
  21.         cout << "\nB class " << m_a << " " << m_b;
  22.     }
  23. };
  24.  
  25. int main(){
  26.     B *b = new B(12, 5);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement