0

How to initialize base class members in Inheritance

Hi.I want to initialize the variables of base class in derived class: class Base{ public: int val = 10; virtual void print(){cout << "Base class\n";} }; class derived1: public Base{ public: void print(){cout << "derived1 class\n";} }; How can I change val in derived1 to 5?

1st May 2019, 4:56 PM
Sobhan Safdariyan
Sobhan Safdariyan - avatar
0 Resposta