I have a class A of Boss1 that has a vector of pointers to another class B of Workers. class C of Boss 2 is to be only an object of one worker(himself).
I will be passing into a function (A&, B&) or (B&, A&)
My function needs to know the size of each object.
For A, i can use vector.size()
How can I do something like this for B?
I apologize for the problem being so confusing. I'm just stumped because classes can't be compared. Any help will be appreciated. Thanks
If you mean that you want to know the number of persons stored in each class then you can implement a function size_t number_of_persons() in each class. One class can the return vector.size() and the other can return 1.
You probably want to think about using a common interface for the two classes an making the number_of_persons method virtual.