Thursday, 6 July 2017

inheritance - protected function call c++

Class Base() {
protected:

void foo();
}
Class Derived : public Base {
void bar();
}

void Derived::bar(){
foo(); //this causes an error.
}



I know i'm probably missing something obvious but I've been going round in circles for an hour. How do I call a protected function in a derived class?

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...