|
don't confuse !!!
static don't alter the visibility accessors (public , protected , private ).
it only tells the compiler that the member declared as static will exist once and will be shared between all the instances of the class...
do you get the difference then ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
I think i havent asked the question clearly
what i actually ment to ask is :
if a member is declared private then it implies, it cannot be accessed by any objects directly.
But in the case of static member varaibles, they can be accessed by using 'class name' followed by '::' operator.
So wouldnt a private menber varaible declared static loose its significance as private if it can be accessed by by the :: operator????
|
|
|
|
|
The static-ness and access of a member variable aren't mutually exclusive. All static means is that there is only one copy of that member for all instances of the class. public/protected/private access all work the same as with non-static members.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I think i havent asked the question clearly
what i actually ment to ask is :
if a member is declared private then it implies, it cannot be accessed by any objects directly.
But in the case of static member varaibles, they can be accessed by using 'class name' followed by '::' operator.
So wouldnt a private menber varaible declared static loose its significance as private if it can be accessed by by the :: operator????
|
|
|
|
|
namaskaaram wrote: So wouldnt a private menber varaible declared static loose its significance as private if it can be accessed by by the :: operator????
Have you tried it to see?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
class test { private: static int foo; };
int test::foo = 1;
main()
{
int x = test::foo;
}
error C2248: 'foo' : cannot access private member declared in class 'test'
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
namaskaaram wrote: how is a static public member variable different from a static public member variable??
From my vantage point, they are identical.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
how to change the icon in title bar in sdi app.
|
|
|
|
|
WM_SETICON or if you're using MFC SetIcon()
|
|
|
|
|
|
If you're programming with MFC use SetIcon() in your Main Frame class:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_SITYPE));
SetIcon(hIcon, false);
...
}
|
|
|
|
|
|
AfxGetApp()->LoadIcon(IDR_MAINFRAME);
Replace IDR_MAINFRAME with our ICON ID.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
|
Can anyone tell me how to show the shell context menu for a file when all you have is the file name. I got a menu to show up but not with all the items and the ones that are there don't work right - when I click on properties the Properties dialog comes up, but with most of the info blank or 0. What I've done so far is get the PIDL for the file by using SHGetDesktopFolder() to get the desktop folder and calling ParseDisplayName which works fine. I think what is going wrong is I'm calling GetUIObjectOf() to get the IContextMenu interface with the desktop folder, when it needs the pidl's direct parent folder. If this is the case how do you get a pidl's parent folder?
- thanks
|
|
|
|
|
|
Thanks for the reply. Unfortunately it uses SHBindToParent() which requires Win2k+
|
|
|
|
|
We are simulating a web cache server using sockets,where
1.a client submits a url from his m/c
2.Request reaches server in the form of successive Http req headers.
3.Server processes each and sends corresp page to client..
The problem we encounter is this..
When the consecutive requests arrive on d same socket..we get a "debug assertion failed" message in sockcore.cpp
BOOL CAsyncSocket::Accept(CAsyncSocket& rConnectedSocket,
SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{
ASSERT(rConnectedSocket.m_hSocket == INVALID_SOCKET);//the debugger points to dis line!!!!!
.....
......
}
We havent used multithreading!
Do we need to use it,or creating multiple sockets would help?
Do we need to post d code snippet?
|
|
|
|
|
You probably are reusing a CAsyncSocket object in a loop. If so, you need to close it before reusing. Try to call Close member after processing each request.
|
|
|
|
|
thanks for the suggestion..We tried it..
but another problem dat surfaces is dat we are not able to decide where exactly to close the socket...this is because our socket recieves consecutive requests..n these should be processed/served in succession.
So if we close it,the 2nd immediate request isnt served,while the later ones are..
Do we attach a snippet here 4 more clarity??
|
|
|
|
|
I think you should call Close not for the socket which executes Accept , but for the socket that is passed to Accept as a parameter. That socket must be closed (or must be a new one) before calling Accept . This is required by MFC.
|
|
|
|
|
We did just that....still the same problem...
|
|
|
|
|
I use Microsoft visual studio.net2003. When internal lib such as Vfw32.lib was used in my programm, there are some errors. The error code is LNK2019. I analysis it may be caused by the internal lib not including in enviroment.
Please give me some suggestions about how to slove the problem .Thanks.
-- modified at 0:15 Monday 12th June, 2006
|
|
|
|
|
Open up your project and under the Project properties go to linker>general
There you will find a entry for additional library directories.
Add vfw32.lib over there.
In your file where you are calling the functions from the library
#include "vfw.h"
//I hope that this solves out your problem
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 1:25 Monday 12th June, 2006
|
|
|
|
|
Hi,
Can anyone guide me how to change the Menu font size either in coding or design time? The default font style and font size are "MS San Serif" and "8 points" respectively. I would like to change to "Tahoma" and "10 points". Any help out there. Thank you.
Wilson
|
|
|
|