Code:
class A
{
private:
int abc;
string xyz;
}
In the above code, how can I access the names by which data members are declared (abc
, xyz
) and print them to console?
Code:
class A
{
private:
int abc;
string xyz;
}
In the above code, how can I access the names by which data members are declared (abc
, xyz
) and print them to console?
The only way I can think of is using a macro:
C++ doesn't have the reflection capabilities of other languages.