I was thinking about this earlier, and it seemed a little unusual. I was hoping that you guys may be able to give me an answer to it.
If a class is declared like so:
Then in the main code, both of the following ways of calling function1() will work. Which one is the best way of doing it, and what is the advantage(s) of doing that way? And why do we declare an object instance if it isn't essential?Code:class functions{ public: void function1(); }; functions Function;
Code:int main() { // Lots of previous code functions::function1(); // Some more code }Code:int main() { // Lots of previous code Function.function1(); // Some more code }