class calling function that is declared outside main()/class

Is it possible for a class to call a function that is declared outside the main() or from another class without inheriting the class.

eg.

class animal{
.....
void insect()
};

class birds{
.....
void feather()
};

void find()

main()
{
....
}

Can insect() call find()? If so, how is it done?
Can insect() call feather() without inheriting birds? If so, how is it done?

Thanks in advance!

You can call find() from any function, as long as find() is declared before the definition of the calling function.
To call feather() from insect() you either need to have a birds object (my_birds.feather();) or to inherit birds. Another option is to make feather a static function. Then you'll be able to call it almost like a normal function but it won't be able to access non-static members of the class ('almost' means that you have to note the scope: birds::feather();)
Topic archived. No new replies allowed.