Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ inheritance constructor

class A
{
    public: 
      explicit A(int x) {}
};

class B: public A
{
      public:

     B(int a):A(a){
          }
};

main()
{
    B *b = new B(5);
     delete b;
}
 
PREVIOUS NEXT
Tagged: #inheritance #constructor
ADD COMMENT
Topic
Name
5+9 =