I thought it would be convenient to create a search class which could gather data from either text or binary files and load said data into variables it was given.
Its use would look something like this:
#include "search.h" double a; long int b; __int8 c; search seeker; seeker.string(search term, array to search through, &a <-- where to store retrieved data); seeker.binary(search term2, array2 to search through, &b <--will overload to correct method, # of bytes to retrieve); seeker.bbinary(search term3, array2 to search through, &c, # of bytes to retrieve ); <--Handles big endian.
Now, I realize I could simply create the above functions and their complementary overloads and place them in a header, however, being able to go
seeker.method(parameters)
gives, I feel, the code an organizational boost.
So, my questions are:
1. Is it a bad practice to use classes solely for the storage of methods?
2. Would my code be made less efficient, were I to declare a class full of methods and use only one of them instead of putting them as functions into a header and just using the one I need?
Example of 2.
#include "search.h" search seeker; seeker.binary(parameters);
vs.
#include "search.h" binary(parameters);


Sign In
Create Account

Back to top









