Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > using of "static const" in class with no imediately init

Reply
Thread Tools

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

 
 
heinquoi
Guest
Posts: n/a
 
      05-10-2004
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


 
Reply With Quote
 
 
 
 
Gernot Frisch
Guest
Posts: n/a
 
      05-10-2004

"heinquoi" <nospam*(E-Mail Removed)> schrieb im Newsbeitrag
news:409f6402$0$27685$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
heinquoi
Guest
Posts: n/a
 
      05-10-2004

"Gernot Frisch" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
>
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
init of class members : mem(0) vs. mem() vs. not-init at all news.aon.at C++ 11 01-29-2011 07:30 PM
jquery onchangeevent for a checkbox doen't fire imediately when userchecks/unchecks. but it fires after user checks/unchecks and clicks outsidean divya Javascript 7 05-26-2010 01:39 PM
questions about object initialization, default-init and value-init Jess C++ 4 05-04-2007 02:47 AM
Sequence Order between Page Init and User Control Init Tony Cheng ASP .Net 1 02-24-2006 01:56 PM
Compiler/Linker Error undefined reference to 'std::ios_base::Init::Init[in-charge]() clusardi2k@aol.com C++ 1 08-18-2005 07:11 PM



Advertisments