Question: I am new in C++ templates.

I have a template struct `AAA` and it has a field called `field`. When some one call it with int like `AAA<int>`, I want to have additional field called `second_field`. Could some one tell me how to fix this code?

```
template<typename T>
struct AAA
{
    T field;
};

template<typename T=int>
struct AAA<int>
{
    int second_field;
};

int main()
{
    AAA<double> ad;
    ad.field=3.14;

    AAA<int> ai;
    ai.second_field=5;

    return 0;
}

```

Answer: 
Two things:

1) The specialisation notation is `template<>`, not `template<typename T=int>`.

2) The specialised type is **not** related to the unspecialised type. There's no inheritance here. `second_field` will be the *only* field.

Putting this together, you need

```
template<>
struct AAA<int>
{
    int field;
    int second_field;
};

```
For the so called template specialization the syntax is a little bit different than in your code:

```
template<>
struct AAA<int>
{
    int second_field;
};

```