spawning multiple processes spread across two files

I want to spawn n child processes but have two different classes..with the foremost one forking/spawning the child process and the latter performing a function w/ the spawned processes.

I can do this in one class with an if statement and the simple

if((pid=fork())==0) //child process
{
//do code
}

else
{
//do code as parent process.
}
In doing in w/ two different classes would I need to pass fork() to the slave class? I don't to fork my main process and have it execute the same code as the parent process I want it to execute its own code. That's why I want a separate child/slave class.

also is there a way to JUST spawn children? I don't understand why fork() would create parent processes.
Hopefully my problem isn't too convoluted, thanks.

You are missing the point.

Your code is executing within one process.

You call fork().

Your code is now executing in two processes, the original process and the child process,

fork() only creates one new process, the child process.