Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

static Class

Status
Not open for further replies.

raghu75

Programmer
Nov 21, 2000
66
IN
Hi,
Can I declare a class as a static Class...
Also Can I declare a member of a class as a static class variable..
I want to do something like this..
class test
{
};
class test1
{
public:
static test myTest;
};

Any IDEAS appreciated....
 
I hope yes. Defining class member as static means that this member of all objects of that class resides on the same memory location and value changed in one object is accessible from other objects. There should be no difference what is the type of the member - class or simple datatype.
 
yes then in ur implementation file u must initialize it:

test test1::myTest = ....; -There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top