Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
This is more of a style issue. I have a standalone function that I want to use in a number of different classes, let's call it foo. On one hand I could simply define and build the function in it's own C++ file, or I could alternatively make it a class, either use the constructor or simply define a static function. Case 1: foo.H class foo { public: foo(arg1, arg2, arg3); }; foo.cc foo::foo(arg1, arg2, arg3) Case 2: Use a static class function foo.H class foo { public: foo() {}; static void foofunc(arg1, arg2, arg3); }; foo.cc foo::foo(arg1, arg2, arg3) { do something } case 2: static foo:foofunc(arg1, arg2, arg3) { do something } What I am looking for is simply an opinion on style. In my specific case the one of the arguments (passed by reference) is an STL container that is populated. Currently, my thoughts are simply to define the function outside of any class (as one would in C). -- Jerry Feldman <gaf at blu.org> Associate Director Boston Linux and Unix http://www.blu.org -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |