I am current trying to learn C++ and I'm a little confused about a constructor I found in a book I am reading and was wondering if anyone can explain to me what something means
Ok... for the class objectc, we have this constructor, right? What are those initializations? I look in the book everywhere and wasn't able to find anything about them. It appears its taking the value in x and assigning it to itsx which is declared as a private variable in the class but the syntax looks like its calling a function, kinda... hence my confused state.Code://this is the constructor objectc::objectc(int x, int y): itsx(x), //Book says these are initializations itsy(y) {} //empty body
Can someone explained to me what these initializations are and what is the syntax to use them and what else can be used in this area?
Between the constructor
objectc::objectc(int x, int y):
and the body
{}
Thanks in Advance.