I have two simple classes, and wish to access the public method stuff
by passing an int
value. why can't I do that with an instance of Bar? Shouldn't it inherit the public method stuff. The type hinting gives the int a
parameter, but it doesn't compile.
class Foo
{
public:
int a;
void stuff(int a){ std::cout << a << std::endl; }
};
class Bar : public Foo
{
protected:
void stuff() { std::cout << "hello world"; }
};
void main()
{
Bar b
b.stuff(3);
}