28

How i love c++

Comments
  • 2
    You can spend the whole life to learn C++. Love it .
  • 4
    Rust and Go: no subclassing, only interface implementations
  • 6
    That's hardly fair, C++'s is the entire method definition, the Java/Python ones are one function in it.
  • 0
    @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.
  • 0
    @osmarks no, they are the superclass constructors
  • 0
    I bow to your superior knowledge.
  • 0
    If I'm going to code in a C-like language these days, I'd use D anyway.
  • 2
    Yeah 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.
  • 0
    @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 ++
  • 1
    @ElectricCoffee im so going to try rust
  • 0
    @RazorSh4rk you're in for a ride. Rust isn't for the faint of heart
  • 0
    @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.
Add Comment