0
Doesn't c++ have a hierarchy just like java?
I mean can methods exist outside the classes.is it a flexibility or a drawback.
4 Answers
+ 3
That depends on the style you want to use c++ in.
c++ is very flexible language and you can choose whether you want the oops approach or the traditional procedural approach.
therefore, you can declare methods in classes if you want oops approach or declare no class at all.
+ 1
you need a source file for string in java too. java just imports that file implicitly without you needing to do anything.
0
but why do we need a source file for string C++ but not in Java for string
0
thanks buddy