I'm trying to implement a relatively basic Base class and Derived class, and getting stumped by an error I don't know how to resolve.
The code I've written is this:
template<bool Owning>
class Base {
protected:
Base() = default;
Base(int * ptr) {
//Do something
}
};
template<bool Owning>
class Derived : public Base<Owning> {
public:
Derived() : Base(new int(5))
{}
};
When I try to compile this code, I get the following error:
<source>: In constructor 'Derived<Owning>::Derived()':
<source>:14:17: error: class 'Derived<Owning>' does not have any field named 'Base'
14 | Derived() : Base(new int(5))
| ^~~~
Compiler returned: 1
Clearly, there's something wrong with how I'm trying to call the Base class' constructor, but I don't know what the correct way to write this is. What should I be writing to get this code to behave properly?