i want to to able to access to a class's vairable but this varible is not declared class's header file
it is in the cpp file i couldn't write a method that acces to it because methods cannot access it(since the variable is not in the header file) how can i solve this problem

Recommended Answers

All 2 Replies

The only way you could possibly access it is if the variable is global and non-static. In that case you could declare it with the extern keyword in your program. If your program links then you should be ok. If it doesn't link, then tough luck, you will not be able to access it.

i want to to able to access to a class's vairable but this varible is not declared class's header file
it is in the cpp file i couldn't write a method that acces to it because methods cannot access it(since the variable is not in the header file) how can i solve this problem

I don't know what your native language is, but in English we have things like periods (.) to end a sentence so you can communicate effectively. Try using them, please. Oh, and that was a comma (,) -- also useful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.