Template Inheritance use case

Hi Guys i basically have

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
template <unsigned int I>
class Numeric {
public:
   //stuff
private:
   //stuff
};

template <unsigned int N, unsigned int P>
class FixedPoint : public Numeric<N> {
public:
  //stuff
private:
  //stuff
};


But i don't know why i have trouble with the inheritance stuff, i.e. the error is

error: provided for 'template<unsigned int N, unsigned int P> class FixedPoint

What does it mean?

Thank you!
Last edited on
The code you show looks fine and it compiles when I try to create a FixedPoint.
(Here's the code: http://cpp.sh/73ro)

Show us how you use that Class-Template.
Nutin is wrong.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

template <unsigned int I>
class Numeric {
public:
    Numeric(){ std::cout<<I<<'\n';}
};

template <unsigned int N, unsigned int P>
class FixedPoint : public Numeric<N> {
public:
    FixedPoint(){std::cout<<P<<'\n';}
};

int main()
{
    Numeric<44> a;
    FixedPoint<42,11> b;
}
Topic archived. No new replies allowed.