I am just confused, when you declare a function in a class, is it public or private by default?
By default, all declarations are private.
You really should make it clear if it is public, private or protected in your code by adding the correct statements. But yeah private unless stated otherwise.
There is a good guide to classes at cplusplus.com/doc/tutorial/classes/
Well let's see:
using namespace std;
error: 'void Apple::sayhi()' is private