-1

When you have a class like such:

ref class App1 sealed : public Windows::ApplicationModel::Core::IFrameworkView{
public: 
virtual void run();
private:
bool m_windowClosed;
bool m_windowOpen;
}
App1::App1() : m_windowClosed(false), m_windowOpen(true)
{
}

When writing the body of the constructor, what does the : do ? by looking at it, it obviously probably sets the values of m_windowClosed before the body is executed. What else is happening? And why would this be used here instead of in the body?

user3236428
  • 5
  • 1
  • 5

1 Answers1

0

It is a special syntax for ctor initializer. After the colon there can be specified data members and base class objects with initializers.

Vlad from Moscow
  • 265,791
  • 20
  • 170
  • 303