473,320 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
Jul 22 '05 #1
2 1530

"heinquoi" <no**************@libertysurf.fr> schrieb im Newsbeitrag
news:40***********************@news.free.fr...
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
Jul 22 '05 #2

"Gernot Frisch" <Me@Privacy.net> a écrit dans le message de
news:2g***********@uni-berlin.de...

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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jan13 | last post by:
Hi, I'm new to programming in C++ (using VC6) and ran into the following problem: I want to declare and define a class member variable as 'static const', but something seems to go wrong with...
3
by: DanielBradley | last post by:
Hello all, I have recently been porting code from Linux to cygwin and came across a problem with static const class members (discussed below). I am seeking to determine whether I am programming...
3
by: Steven T. Hatton | last post by:
Sorry about the big code dump. I tried to get it down to the minimum required to demonstrate the problem. Although this is all done with GNU, I believe the problem I'm having may be more general. ...
1
by: Bryan Parkoff | last post by:
I know how to write "Pointer to Function" inside struct or class without using static, but I have decided to add static to all functions inside struct or class because I want member functions to be...
9
by: Neil Kiser | last post by:
I'm trying to understand what defining a class as 'static' does for me. Here's an example, because maybe I am thinking about this all wrong: My app will allows the user to control the fonts...
2
by: tomi | last post by:
Hi I'm creating a small IS and I'm wondering if is a good idea to create one static class which will hold methods that will access the database. So I'd have only one class in the memory used for...
6
by: Marty | last post by:
Hi, I have a class that I modified to be static. It is now a public sealed class and all function are static, no more constructor but a init() function to do the constructor job. This class...
11
by: Raja Chandrasekaran | last post by:
Hai folks, I have a question to get exact answer from you people. My question is How Static class is differ from instance class and If you use static class in ASP.NET, ll it affect speed or...
7
by: Jon Vaughan | last post by:
I have a piece of code that I want to run on a Pocket Pc, I have written a data class that will store the small amount of data that is required for the program. As this class will be used via a few...
13
by: learning | last post by:
Hi I have a static class written by other team which encapsulates a database instance. but I need to extend it to incldue other things. I know that C# static class is sealed and can;t be inherited...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.