Advertisement

"static" stuff in C++

Started by April 12, 2002 03:22 PM
12 comments, last by Tac-Tics 22 years, 8 months ago
I tried the Java-style, but it no wanted to work. Also, I didn''t think you could use that Class::staticObj notation on private members. And also, doesn''t that only allow me to make a dynamicly created object? You used an int example, but could you do:
int A::privateStaticObject(cnstrParam1, cnstrParam2);
quote:
could you do:
int A::privateStaticObject(cnstrParam1, cnstrParam2);

Sure. But that''s an invalid declaration because that''s a function. You could do this, though:
class A{private:  static Object my_obj;};Object A::my_obj( /* params */ ); 


[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
Advertisement
quote: Original post by Tac-Tics
I tried the Java-style, but it no wanted to work.

It doesn''t work in MSVC 6, if that''s what you tried it in.

Borland free command line compiler =-)
The command lines pwn IDE's. Esp evil~ MS's VC++.

vv Edit warning vv

[edited by - Tac-Tics on April 12, 2002 12:21:39 AM]

This topic is closed to new replies.

Advertisement