Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
osmarks8668yThat's hardly fair, C++'s is the entire method definition, the Java/Python ones are one function in it.
-
@osmarks That was my reaction. Calling a function in C++ is essentially equivalent to the others. Defining a method is slightly more verbose, but not as dramatic by reliable, fair comparison.
-
Tungdil28yYeah well, but you call the SuperClass constructor with :SuperClass(x), if it had no arguments like the others you don't even need it. Also comparing 1 function call within a constructor with a whole definition of one is really not fair.
-
@Tungdil if i butcher it down to the absoulte minimum, its still Subclass:Superclass(){} and it doesnt even work. The others are not "just functions" they do the exact same
Welcome to devrant btw, have a ++ -
Tungdil28y@RazorSh4rk
It should be
Subclass ()
: Superclass ()
{
//constructor stuff
}
for C++
and for Java:
Subclass ()
{
super () ;
// constructor stuff
}
For the full constructors.
A constructor is just a function, a special one but just a function so super () is basically a function call. As is Superclass () in C++.
As for the syntax I personally like C++ more, simply because you can see what your base class is in the constructor definition.
How i love c++
undefined