|
kumar_windows wrote: is there any thing like static class in c++
What do you mean exactly ? Can you be more explicit and explain what you want to do exactly ?
Yes, you can declare a class static like any other variable but I don't know if this is what you are looking for.
Cédric Moonen
Software developper
Charting control
-- modified at 9:43 Friday 12th May, 2006
Sorry, not very clear . As toxxct said (and what I meant by saying that) is declaring an instance of a class static, not the class itself
|
|
|
|
|
Cedric Moonen wrote: Yes, you can declare a class static like any other variable
actually, you're not declaring the class static but the instance of the class...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Yes, my post has already been modified . It's friday afternoon so my english skills tend to decrease
Cédric Moonen
Software developper
Charting control
|
|
|
|
|
Cedric Moonen wrote: Sorry, not very clear . As toxxct said
damn, toxcct, not toxxct think to "toxicity" if that can help... anyway, ok, friday afternoon... hehehe
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Do you think it's easy not to make mistakes while typing with your nose ?
Cédric Moonen
Software developper
Charting control
|
|
|
|
|
|
Cedric Moonen wrote: while typing with your nose ?
Again Nose
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hello cedric,
it was an interview question,
u mean to say i can declare a class as static like
static class A{----};
what is its purpose, please elaborate on single instance of a class, u mean when i create an object for this class
thanks kk
|
|
|
|
|
kumar_windows wrote: is there any thing like static class in c++
Are you looking something like SingleTon Classes[^]?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi alok,
no not a singleton class, it was an interview question abt the static class, do we have it just like a static member variable and static function,
wat is its significance/purpose?? can i create an object for this static class?? wat happens?
thank u, kk
|
|
|
|
|
The code snipet below demonstrates the variable instance obj to be static not the type Type , even though it would be confusing you.
#include <iostream>
int main()
{
static class Type
{
public:
void Hello() { std::cout << "Type::Hello() \n"; }
} obj;
obj.Hello();
return 0;
} Which is equivelent to:
#include <iostream>
int main()
{
class Type
{
public:
void Hello() { std::cout << "Type::Hello() \n"; }
};
static Type obj;
obj.Hello();
return 0;
}
Maxwell Chen
|
|
|
|
|
i hesitated to show off this example, but finally didn't, thinking it would confuse most beginners around. by the way, it is perfectly legal to do so, as we declare a variable with the type definition inlined...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
And a further example to demonstrate that the member variables are not shared among individual static instances.
#include <iostream>
static class Type
{
int v;
public:
void Hello() {
std::cout << "Type::Hello() \nv = " << v << " \n";
}
void Hello(int n) {
v = n;
std::cout << "Type::Hello(" << v << ") \n";
}
} g_obj, g_objx;
int main()
{
std::cout << "g_obj \n";
g_obj.Hello(3);
g_obj.Hello();
std::cout << "g_objx \n";
g_objx.Hello();
return 0;
} The output goes to:
g_obj
Type::Hello(3)
Type::Hello()
v = 3
g_objx
Type::Hello()
v = 0
Maxwell Chen
|
|
|
|
|
C# has the concept of a static class: a static class is a class that contains only static members and instances can't be created with the new keyword. C++ has no such concept; although you can create classes with only static members you do so explictly and the compiler will not stop you from adding a non-static member.
Steve
|
|
|
|
|
kumar_windows wrote: is there any thing like static class in c++
No.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I am getting the following error while compiling a project in a workspace.
fatal error LNK1202: "C:\product\GUI\Widgets\SafetyEventLine\Modules\vc60.pdb" is missing debugging information for referencing module
Please let me know:
1] Why does this error occour?
2] How to prevent this error
regards
-- modified at 9:20 Friday 12th May, 2006
|
|
|
|
|
and if you again rebuild project did you get this error?
|
|
|
|
|
Yes....i get this every time I am building my project
|
|
|
|
|
i got this only once many years ago(i dont remember whats happen exactly)
but i know your program has one error
Did your prgoram is run in memory?
-- modified at 9:39 Friday 12th May, 2006
and you close Vs and run again you build program you get this error right?
|
|
|
|
|
yes it repeats every time i try to build the dsp.
|
|
|
|
|
well explain this error is difficult for me i know this error but i cant say that how you solve this error
|
|
|
|
|
I also have got yhis problem but
I solve it:
it can be happen if you have a library and you has changed its location.
When you relocate that library, there is no problem
|
|
|
|
|
Even with a Rebuild All?
Have you tried removing the vc60.pdb file?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Yes....but the result is same
|
|
|
|
|
Do the following things.
1)Delete all the .obj and .pdb(program database (PDB)) files
2)use the compiler's /Zi option
3)Rebuild the application
AppU
Appu..
"If you judge people, you have no time to love them."
|
|
|
|