0

What is

constructor(int x) : x_(x) { empty }

I was solving this hackerrank question related to class and saw this.

public:
    HotelRoom(int bedrooms, int bathrooms) 
    : bedrooms_(bedrooms), bathrooms_(bathrooms) {}

Is this a better way to build constructors?

Damien
  • 4,611
  • 4
  • 13
  • 19

0 Answers0