Question: In the following code snippet, which constructor is called for the object declaration CashRegister reg ( 5 ) ? class CashRegister { public: CashRegister (

In the following code snippet, which constructor is called for the object declaration CashRegister reg(5)?
class CashRegister
{
public:
CashRegister();
CashRegister(int count);
void set_item_count(int count);
void view() const;
private:
int item_count;
};
CashRegister::CashRegister(){ set_item_count(0); }
CashRegister::CashRegister(int count)
{
set_item_count(count);
}
int main()
{
CashRegister reg(5);
return 0;
}
Question 2 options:
CashRegister()
CashRegister(int count)
set_item_count(int count)
CashRegister(double count)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!