Hi,
I'm currently overloading the istream operator to construct an object.
This works as such: cin >> Person("darren", 32);Code:istream& operator>>(istream& is, Person&) { string name; int age; is >> Person(name, age); return is; }
I know, I can just construct objects without using the >> operator, but this is an exercise in the book. My question is when I do it this way, I am not giving the object a name as such. How can I do that? For example if I was constructing this just via the constructor I would use: Person p("darren", 32).
Thanks.