Please, anyone can explain the syntax here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please, anyone can explain the syntax here?

public: Pair (T a, T b): first(a), second(b) { } between the (T a, T b) and {}, there are first(a) , second(b). what's the syntax mean?

30th Jan 2017, 2:02 AM
Bing Du
Bing Du - avatar
2 Answers
+ 2
The constructor initializes the variables 'first' and 'second' in class Pair with the values of 'a' and 'b'.
30th Jan 2017, 3:24 AM
Robobrine
Robobrine - avatar
0
thank you Robobrine
30th Jan 2017, 2:10 PM
Bing Du
Bing Du - avatar