I
Immortal Nephi
There are many global functions with numbers of parameters and return
type. I want to group them into a class. The class does not have
data members because functions do not need them. I include that class
into another class. Is practice normal?
For example:
class Foo
{
public:
int foo( int a, int b ) { /*…*/ return iReturn; }
int bar( int a, int b, int c ) { /*…*/ return iReturn; }
/*…*/
int doit( int a ) { /*…*/ return iReturn; }
/* Do not need to include data members here */
};
class Object
{
public:
Foo foo;
void doit() { foo.bar( 1, 2, 3 ); }
private:
/* Here are data members */
};
int main()
{
Object obj;
obj.doit();
return 0;
}
type. I want to group them into a class. The class does not have
data members because functions do not need them. I include that class
into another class. Is practice normal?
For example:
class Foo
{
public:
int foo( int a, int b ) { /*…*/ return iReturn; }
int bar( int a, int b, int c ) { /*…*/ return iReturn; }
/*…*/
int doit( int a ) { /*…*/ return iReturn; }
/* Do not need to include data members here */
};
class Object
{
public:
Foo foo;
void doit() { foo.bar( 1, 2, 3 ); }
private:
/* Here are data members */
};
int main()
{
Object obj;
obj.doit();
return 0;
}