How Does Vertex Buffer Description Read Input Data in DirectX 11?

The private vs public only applies to C++ code and is enforced by the compiler. Instances of Math3 are just a block of 12 bytes in memory with no special hardware protections.

In other words, from an 'in-memory' perspective the Math3 is exactly the same if it's:

class Math3
{
public:
    float x;
    float y;
    float z;
};

// this is the same as
struct Math3
{
    float x;
    float y;
    float z;
}

If you do a sizeof on the class, it's the same.

A vertex buffer is just a block of memory. The GPU knows the data type, size, padding, etc. from the Input Layout description when you create the input layout.

const D3D11_INPUT_ELEMENT_DESC InputElements[] =
{
    { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};

If you added a virtual method to your Math3 class, then the layout of the memory would change and it would no longer 'just work'.

The Input Assembler takes the active Input Layout and uses it to parse the vertex information out of one or more vertex buffers. Therefore, it's able to understand a variety of complex layouts and even merge from multiple buffers at runtime.

In the end, all that matters is that your C++ code uses the same 'in-memory' organization for vertex data as described by the input layout and that your Vertex Buffer itself respects that organization.