I
Immortal Nephi
My project grows large when I put too many member functions into one
class. The header file and source code file will have approximately
50,000 lines when one class contains thousand member functions. Is it
normal how C++ Compiler can compile large class without any problem?
Didn't C++ Compiler have rules to limit the number of member
functions?
One big object has complex operations how member variables and member
functions can be manipulated according to my design. I put almost
4,000 member functions inside one class. The class with 4,000 member
functions is compiled without any problems and it runs very well.
Can you do your best judgment? Is the practice best if I write one
large object? Please note that only very few 5-10 member functions
are public and other all thousand member functions are private.
Here is an example
// header
class Obj
{
public:
Obj();
~Obj();
void Run();
private:
void mfunc1();
void mfunc2();
......
......
......
void mfunc4000();
}
// source
void Obj::mfunc1()
{
}
.....
.....
.....
void Obj::mfunc4000()
{
}
These thousand member functions are like one big vtable pointer.
One big member function pointer array can be used to access all
thousand functions like this p_mfunc[xx][xx][xx](); This is neat when
I allow to group thousands functions into main functions, sub-
functions, and sub-sub-functions.
Are you sure that it is worth best practice? You are prepared to
do future project while you are working right now as I do.
Nephi
class. The header file and source code file will have approximately
50,000 lines when one class contains thousand member functions. Is it
normal how C++ Compiler can compile large class without any problem?
Didn't C++ Compiler have rules to limit the number of member
functions?
One big object has complex operations how member variables and member
functions can be manipulated according to my design. I put almost
4,000 member functions inside one class. The class with 4,000 member
functions is compiled without any problems and it runs very well.
Can you do your best judgment? Is the practice best if I write one
large object? Please note that only very few 5-10 member functions
are public and other all thousand member functions are private.
Here is an example
// header
class Obj
{
public:
Obj();
~Obj();
void Run();
private:
void mfunc1();
void mfunc2();
......
......
......
void mfunc4000();
}
// source
void Obj::mfunc1()
{
}
.....
.....
.....
void Obj::mfunc4000()
{
}
These thousand member functions are like one big vtable pointer.
One big member function pointer array can be used to access all
thousand functions like this p_mfunc[xx][xx][xx](); This is neat when
I allow to group thousands functions into main functions, sub-
functions, and sub-sub-functions.
Are you sure that it is worth best practice? You are prepared to
do future project while you are working right now as I do.
Nephi