RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++Code

Learn About How To Use Non-static Data Member Initializers For Windows Apps In C++

Embarcadero Bcc32c and bcc32x (Clang-enhanced compiler for Win32) implements all of the ISO C++11 standard. It includes the use of non-static data member to be initialized where it is declared. The basic idea for C++11 is to allow a non-static data member to be initialized where it is declared (in its class). A constructor can then use the initializer when run-time initialization is needed.

Why useful.
-Easier to write.
-You are sure that each member is properly initialized.
-You cannot forget to initialize a member like when having a complicated constructor. Initialization and declaration are in one place – not separated.
-Especially useful when we have several constructors.
-Previously we would have to duplicate initialization code for members.
-Now, you can do a default initialization and constructors will only do its specific jobs.

If a member is initialized by both an in-class initializer and a constructor, only the constructor’s initialization is done (it “overrides” the default).

Head over and find out more about C++ non-static data member initializers in the Embarcadero DocWiki!


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts
DelphiRAD Studio

Learn About Delphi Continuous Integration With SVN, Jenkins, And DUnitX

DelphiShowcase

Wildly Popular Inno Setup Is A Free Installer For Windows Built In Delphi

C++CodeDelphi

Learn To Build A Python GUI For Working With The Numpy Library In A Delphi Windows App

C++DelphiRAD Studio

Speed Up FireMonkey Layout Construction And Painting Performance With These Tips

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES