using of "static const" in class with no imediately init

H

heinquoi

hello,

i have the code:
class window
{
static const HWND hWnd;
static const HINSTANCE hInst;
// ... next code here
window (HINSTANCE );
}
window::window ( HINSTANCE hInstance )
{
// and i try to definie the hInst
hInst (hInstance);
// next code here
}
But that not accepted for my compiler intel 8.0
How i can initialize a static const data in my code, but not immédiately and
in a fonction.
thank you for your response.
HEINQUOI
 
G

Gernot Frisch

heinquoi said:
hello,

i have the code:
class window
{
static const HWND hWnd;
static const HINSTANCE hInst;
// ... next code here
window (HINSTANCE );
}
window::window ( HINSTANCE hInstance )
{
// and i try to definie the hInst
hInst (hInstance);
// next code here
}
But that not accepted for my compiler intel 8.0
How i can initialize a static const data in my code, but not immediately and
in a fonction.


use const HWND hwnd = ... or leave the const off. You cannot assign
any "const" variable a value other than on creation of it.
Make your variable private, so nothing can alter it from outside.

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
 
H

heinquoi

Gernot Frisch said:
use const HWND hwnd = ... or leave the const off. You cannot assign
any "const" variable a value other than on creation of it.
Make your variable private, so nothing can alter it from outside.

thank for your answer
Heinquoi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top