So far, from what I've learned from the c++ book I'm reading, the int main() function in a c++ class is kind of like the public static void main(String args) method in java. (I'm a java person and I'm new to c++).
However, I found out that within my source folder, I can't have two c++ classes with int main functions. Basically I wrote a class for printing out hello world and then I wrote another class for adding two numbers and printing the result, all in the same source folder, and I'm getting an error that says "multiple definitions of main".
Why is this happening?
In java it's possible to have a main method in each class. Why is it different for C++ and what's the alternative?
Edited 6 Years Ago by glenak: n/a