0

I am new to c++, and I am going to implement a program, which takes a bunch of data, stored in a comma separated vector file, and classified them. That is to say, it contains specification of employee that are employed in a company, and by using this program, user will have ability to promote or set salary of each of them. Now, I've confronted a problem. I want to define subscript operator, but I don't know how I could design it, since the program I designed asks the user to enter last name, then it will search for the entered name and do some kind of predefined operations. Should I use iterator header file or there is some other ways? I would wholeheartedly appreciate those who have some kind of relevant experience and share them with me.

Thanks.

matt sh
  • 1
  • 2
  • 1
    You're going to want to read this: [What are the basic rules and idioms for operator overloading?](https://stackoverflow.com/questions/4421706/what-are-the-basic-rules-and-idioms-for-operator-overloading), found by putting `[cpp] operator overloading` in the search box of this site. – WhozCraig May 22 '20 at 11:47
  • It's hard to understand what the issue is here. Why operator[]? Why not just write a normal function to do what you want? Or would you have trouble writing a normal function too? It usually helps to illustrate what your problem is with some code, even if that code doesn't work or doesn't compile. – john May 22 '20 at 12:07

0 Answers0