Search:
Forum
Beginners
Initialization with Curly Brackets
Initialization with Curly Brackets
Feb 9, 2020 at 8:13pm UTC
AlanB
(6)
I saw this line of code in a program and although it looks simple I don't understand the reason behind initializing with curly brackets.
1
2
3
4
//Default Constructor
Person() =
default
;
//Constructor
Person(
const
string & name = {});
Feb 9, 2020 at 8:29pm UTC
jlb
(4973)
In this case it signifies a parameter with a default value of an empty string. The braces signify "uniform initialization" (actually assignment in this case).
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs