|
-
Dec 18th, 2003, 04:35 PM
#1
Static methods like in Java
I am making a class that can be used to get all the informations about the screencards on a PC. So we know what we can use in the DX app.
All the information is going to be shown in a window with textboxes and combo boxes. But I was wondering. How does it work in C++. I have seen a app that does more or less that. But that app has not any class for it at all. Does that meen that I can make a headerfile with prototypes of all the functions that I need and put the functions in the cpp file and then use them the same way as static methods in Java. Or should I use a class?
-
Dec 18th, 2003, 05:02 PM
#2
BTW not sure if I made my self clear....but what I want is to not have to make a object of the class (or not class) to get all the information about the display adapters...
-
Dec 19th, 2003, 03:35 AM
#3
transcendental analytic
there are static methods in c++ classes too.. still i think its a bit redundant just to have a class for methods, unless you're going to use it for generic programming..
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 19th, 2003, 06:32 AM
#4
Originally posted by kedaman
there are static methods in c++ classes too.. still i think its a bit redundant just to have a class for methods, unless you're going to use it for generic programming..
No I am not going to use them for that....so maybe I am just best of with forgetting about the classes....thanks anyway....
ØØ
-
Dec 19th, 2003, 11:08 AM
#5
transcendental analytic
if you just want to wrap them to avoid name clashes then you can use namespaces
KS
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 19th, 2003, 11:53 AM
#6
It makes perfect sense to have a global enumerator be a static member of the class it enumerates, like this:
Code:
class Screen {
public:
Capabilities getCaps();
// etc.
static Iterator enumerateScreens();
};
where Iterator follows the iterator concept and has a value type of Screen.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 19th, 2003, 03:04 PM
#7
Originally posted by kedaman
if you just want to wrap them to avoid name clashes then you can use namespaces
KS
That is not the point. We are 4 Norwegians working on the project, so I guess all the function names and variable names will be in Norwegian.
-
Dec 19th, 2003, 03:07 PM
#8
Originally posted by CornedBee
It makes perfect sense to have a global enumerator be a static member of the class it enumerates, like this:
Code:
class Screen {
public:
Capabilities getCaps();
// etc.
static Iterator enumerateScreens();
};
where Iterator follows the iterator concept and has a value type of Screen.
Yeah that makes sense....I am always forgetting about Iterators. Don't unse them to much. Think I should think a bit more on them in my coding.
OK...thanks both of you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|