class Base {
public :
Base ( int a , int b ) : a ( a ) , b ( b ) { }
protected :
int a , b ;
} ;
I have this class called Base, how do I create an inherited class Derived with a function that will multiply protected members a and b?
class Derived : public Base {
public:
void print() {
cout << a * b;
}
};
int main() {
Base b(2, 3);
Derived d;
d.print();
}
This is what I attempted but I get error message ' the default constructor of "Derived" cannot be referenced -- it is a deleted function