I am confused over the behavior of constructor in this code.
class htc {
public:
htc() { std::cout << "HTC_FOO_CONSTRUCTOR" << std::endl ;}
htc(const htc&) { std::cout << "HTC_BAR_CONSTRUCTOR" << std::endl;};
};
int main()
{
htc one; // This outputs HTC_FOO_CONSTRUCTOR
htc two(); // This outputs nothing
htc three(one)
}
Couple of questions whats the meaning of using brackets in htc two()
mean? & in constructor htc(const htc&)
there is no parameter name is this ok? If yes whats the use of an such constructor?