Doesn't c++ have a hierarchy just like java? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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.

22nd May 2017, 1:53 AM
Sukumar Patnaik
Sukumar Patnaik - avatar
4 Antworten
+ 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.
22nd May 2017, 2:08 AM
Nikunj Arora
Nikunj Arora - avatar
+ 1
you need a source file for string in java too. java just imports that file implicitly without you needing to do anything.
22nd May 2017, 2:16 AM
Nikunj Arora
Nikunj Arora - avatar
0
but why do we need a source file for string C++ but not in Java for string
22nd May 2017, 2:13 AM
Sukumar Patnaik
Sukumar Patnaik - avatar
0
thanks buddy
22nd May 2017, 2:26 AM
Sukumar Patnaik
Sukumar Patnaik - avatar