how to get a variable from void inside a class

header
1
2
3
4
5
6
7
8
calss test
{
public:
       void load()
{
int var=5;
}
};


main.cpp

1
2
3
#include "header.h"
test get;
get.load()


now i want to get var form the void how :S
Last edited on
If you want to get the value of a local variable, you need to return it, pass i a reference which you'll modify or edit an external variable ( a class member in your case )
Why do you need that?
int load() const {return 5;}
Topic archived. No new replies allowed.