copy constructor

Hi. I need a copy constructor that takes three arguments for class Customer. Please help with the code that produces such a constructor.
This is my code:

string Hotel::TEST(int newRoomCount, int newGuestCount)
{
string result;
for(int i=0; i<newRoomCount; i++)
{
Room iRoom(randString(8),
randString(0, 250),
randString(0, 250),
randString(0, 250),
randString(0, 250));
listOfRooms.add(iRoom);
}
for(int i=0; i<newGuestCount; i++)
{
Customer cust(randString(12), randString(8), randString(20));
listOfCustomers.add(cust);
}

for(int i=0; i<newGuestCount+newRoomCount; i++)
{
checkIN(listOfRooms.getRandID(), listOfCustomers.getRandID());
return result;
}
}

I need a copy constructor that takes three arguments for class Customer.


I think you're getting your terminology mixed up. A copy constructor takes exactly 1 argument: the object to copy.

You can have a constructor with 3 arguments, sure, but it won't be a copy constructor:

1
2
3
4
5
6
7
8
9
10
MyClass::MyClass( const MyClass& obj_to_copy )
{
  // a copy constructor
}

MyClass::MyClass( int a, int b, int c )
{
  // a constructor that takes 3 arguments
  //  (not a copy constructor)
}
Topic archived. No new replies allowed.