Hello I have trouble with working an inheritance constructor. I can't access the parent's fields.
Here is my MyClass.h:
#include "Parent.h"
class MyClass : public Parent {
public:
MyClass(string otherParameters);
};
Here is MyClass.cpp:
#include MyClass.h
MyClass::MyClass(string otherParameters) : Parent() {
parent_field = "something";
}
The field otherParameters does not come from Parent and pertains only to the class MyCLass. The compiler pops out errors and tells me Parent::parent_field is private. I don't undersrtand, my class MyClass should have inherited this parent_field attribute, so why can't I have access to it? Thanks