Compile error with "this" keyword in a struct constructor? - C++

Viewed 8660

I have the following:

int main()
{
    struct A
    {
        unsigned char x, y;

        A(unsigned char x, unsigned char y)
        {
            this.x = x; // Error: expression must have class type.
            thix.y = y; // Error: expression must have class type.
        }
    };

    return 0;
}

How do I properly refer to the x and y variables of the struct A and not the x and y variables of the constructor parameters of A?

Thank you.

1 Answers
Related