I thought that the constructors control the initialization and control assignment of operator = functions in C ++. So why does this code work?
#include <iostream>
In the third line of the main function, I assign an int object of class Deg . Since I don't have an operator=(int) function, I thought that of course it would fail ... but instead, it calls the Deg(int a) constructor. So do designers also manage the assignment?
c ++ initialization class operator-overloading
Vlad the Impala
source share