Should I include common routines members in one "include header" or use separate header for each class?

I have a big project with many classes in diferent files including their methods in diferent files also.

I have some RAF manipulation routines functions which are put in each class as members

1ST OPTION
Till now I declare them inside the class and i include a header outside them.
A diferent file for each class but all containing the same routines.
e.g
1
2
3
4
5
6
7
8
9
10
11
class SERVER {
bool writeINT(string Filename, size_t pBlock intSTRUCT iCELL );
};
#include "routines.SERVER.h"

class EXECUTOR {
bool writeINT(string Filename, size_t pBlock intSTRUCT iCELL );
};
#include "routines.EXECUTOR.h"

routines.SERVER.h
bool SERVER::  writeINT(string Filename, size_t pBlock, intSTRUCT iCELL )
{...}

routines.EXECUTOR.h
----------------------------------------------------
bool EXECUTOR::writeINT(string Filename, size_t pBlock, intSTRUCT iCELL )
{...}

2ND OPTION
I can also just declare them with no parametres and include the same header on both
e.g.
1
2
3
4
5
6
7
8
9
10
11
class SERVER {
bool writeINT();
#include "routines.h"
};

class EXECUTOR {
writeINT();
#include "routines.h"
};

routines.h
bool writeINT(strinf Filename, size_t pBlock, intSTRUCT iCELL )
{...}

In this option however i lose the ability to see the parametres of each function. I can put them as comments however

Thats the best solution if there ll be changes No? What do you suggest?

Can I get another risk this way i dont see?
(writing include is as to copy-paste the file contents in that place no? no other program binding yes?)
Last edited on
closed account (j2NvC542)
I suppose what you want to know, is about inheritance?
Don't do that. I didn't quite understand what exactly you're trying to achieve, but I doubt any good solution would include including headers in random places.
OH YES I CAN DONE IT THROUGH INHERITANCE ALSO!

THATS PRODUCTIVE AND PROFESSIONAL!

HOW CAN I HAD FORGOT!

Thank you so much. I doubt there are other solutions. I ll leave it Unsolved 24 hours however.

@hanst99
Many classes will use common routines like
Deep_Copy_This_Specific_Structure_Common_to_all_Clases
(STRUC sourceSTRUCT, STRUCT destinationSTRUCT);
closed account (j2NvC542)
I'm glad I could help! :)
Topic archived. No new replies allowed.