Question: I want to use template classes and depending on the given int number. It should be chosen class.

Code:

```
template<3>
    class  Point
    {
    private:
        double x;
        double y;
        double z;
    };
template<2>
    class  Point
    {
    private:
        double x;
        double y;
    };

```

How to do this?

Answer: 
You probably want [template specialization](http://en.cppreference.com/w/cpp/language/template_specialization). See this example:

```
// Add a template and make it empty
template <size_t N>
class Point {};

// Specialize it!
template <>
class Point<3>
{
    private:
    double x;
    double y;
    double z;
};
template <>
class Point<2>
{
    private:
    double x;
    double y;
};

```

You can even make `Point<3>` compatible with `Point<2>` using derivation!

```
template <>
class Point<3> : public Point<2>
{
    private:
    // No need to add x and y as they're inherited
    double z;
};

```
You can declare the template parameter as an int like this:

```
#include <iostream>
#include <array>

template<int N>
class Point {
public:
  std::array<double,N> _coordinates;
  void Print();
};

template<int N>
void Point<N>::Print()
{
  for (int i=0; i<N; ++i)
    std::cout << _coordinates[i] << "  ";
  std::cout << "\n";
}

int main()
{
  Point<4> A;
  A._coordinates[0] = 1;
  A._coordinates[1] = 8;
  A._coordinates[2] = -101;
  A._coordinates[3] = 999;
  A.Print();
  return 0;
}

```