1

Is there any built in function in CPP to see member variable ? for example: '''

struct X
{
    data-type var1;
    data-type var2;

};
int main()
{
    struct X A1;
    cout<< func(A1);
    //here the func will return the var1 and var2 for A1 , and print it for me
    return(0);

};

''' output:

var1var2
Abhishek Bhagate
  • 5,583
  • 3
  • 15
  • 32
jamilonly
  • 39
  • 6
  • 2
    You are looking for [reflection](https://stackoverflow.com/questions/41453/how-can-i-add-reflection-to-a-c-application) which is not readily available in C++ – Cory Kramer Jul 15 '20 at 18:20

1 Answers1

0

This is no reflection in C++ builtins due to performance penalty. You can check some external libraries like XCppRefl.

Check XCppRefl: http://www.extreme.indiana.edu/reflcpp/

ytQAQ
  • 11
  • 1
  • 3