为什么可变参数模板在C ++中的行为如此?

I need help understanding this piece of code. There are no loops available, so how can the template, which I know is processed at compilation time, fetch all the arguments, and why did it call the same variable "c" which was incremented even though it is only in the specialized "Z" version ?

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

using namespace std;

class Z
{
    Z() {}
    virtual ~Z() {}
};

class A
{
    A() {}
    virtual ~A() {}
};

class B
{
    B() {}
    virtual ~B() {}
};

template <class P, class... args>
class TCount : public TCount<args...>
{
public:
    TCount() : TCount<args...>() { this->c++; }
    virtual ~TCount() {}
};

template <>
class TCount<Z>
{
protected:
    int c;

public:
    TCount() { c = 0; }
    int getC() { return c; }
    virtual ~TCount() {}
};

int main()
{
    TCount<A, B, A, B, Z> tCount;
    cout << tCount.getC() << endl;
    return 0;
}