Fetching attributes whose values are different in two objects of same class

Hi Team,

I would like to know how to find out the attributes of two objects of same class type whose values are different.

For example:
class a;
int x, y;
endclass

class b;
a a1 = new();
a a2 = new();

a1.x = 1;
a1.y = 2;

a2.x = 1;
a2.y = 3;

endclass

In output, I would like to have attributes/prints like below.

Between object a1 and a2, “Y” value is mismatching.

P.S : X and Y are just examples. There can be 100 attributes inside that class.

Thanks,
Prasad

In reply to psubudhi:

SystemVerilog has no automated way of doing this. If you want to look at the UVM, it has the infrastructure to do this for a limited number of types using a combination of macros and methods in its base class library.

In reply to dave_59:

Thank you Dave for your response.
I am okay to with UVM as well. Can you provide some more details on the macros/methods? If any reference is available then please point me as well.

Thanks,
Prasad

In reply to psubudhi:

https://verificationacademy.com/cookbook/macrocostbenefit