1

I am still quite new to C++ and I very much excuse myself if this is kind of a stupid question, but I am following the Ray Tracing in One Weekend-tutorial and I encountered this syntax for the class constructors. I don't really understand what this does exactly; it looks like an inheritance operator but I can't imagine how the constructor inherits from an array, so hence the question.

Code:

class vec3 {
public:
    vec3() : e{0,0,0} {}
    vec3(double e0, double e1, double e2) : e{e0, e1, e2} {}

    double e[3];
};

Thank you!

ovda96
  • 75
  • 8

0 Answers0