October 10
I'm trying to get my head around mixing templates. I'm using it as kind of a replacement for class inheritance as it seems to fit better composition over inheritance. So I do something like:

    mixin template NumberTemplate()
    {
    private:
        int number = 0;
    public:
        int getNumber(int number)
        {
            return number;
        }
    }

    interface INumber
    {
        getNumber(int number);
    }

    class Number : INumber
    {
        template NumberTemplate;
    };

So two questions:

a) Is this correct usage?

b) It compiles if I just do:

    template NumberTemplate()
    {
    private:
        int number = 0;
    public:
        int getNumber(int number)
        {
            return number;
        }
    }

what is the difference between template and mixin template?
October 10
On Thursday, 10 October 2019 at 15:56:36 UTC, Just Dave wrote:
> I'm trying to get my head around mixing templates. I'm using it as kind of a replacement for class inheritance as it seems to fit better composition over inheritance. So I do something like:
>
>     mixin template NumberTemplate()
>     {
>     private:
>         int number = 0;
>     public:
>         int getNumber(int number)
>         {
>             return number;
>         }
>     }
>
>     interface INumber
>     {
>         getNumber(int number);
>     }
>
>     class Number : INumber
>     {
>         template NumberTemplate;
>     };
>
> So two questions:
>
> a) Is this correct usage?
>
> b) It compiles if I just do:
>
>     template NumberTemplate()
>     {
>     private:
>         int number = 0;
>     public:
>         int getNumber(int number)
>         {
>             return number;
>         }
>     }
>
> what is the difference between template and mixin template?

Sorry I messed up the above code example the following should look like:

    class Number : INumber
    {
        mixin NumberTemplate;
    };