I've been working on a Shape program lately ( Some of you might remember my other questions about this... ;/ ) And I have a tiny problem which I want to fix.

In my Menu class, which holds all the functions related to the menu. I have a unique\_ptr vector with the type of my base class Shape which holds all of the newly created objects ( Circles, Rectangles, ect )

```
protected:
    vector<unique_ptr<Shape>> _shapes;

```

One of the functions that I want to create is supposed to change the values of the variables in a given shape based on it's index. To do so, I was planning to print the vector to the user, and then let him to choose the index of the shape that he wants to change.

```
void Menu::printShapes() const
{
    int i = 0;
    for (auto p = _shapes.begin(); p != _shapes.end(); p++, i++)
    {
        cout << i + " ";
        (*p)->printDetails();
        cout << endl;
    }
}

```

The problems lays in my main program which is going to use my Menu functions. Because I don't want the user to be able to enter values which are outside of my vector, I have to check if the given input is between 0 and the size of the vector. But I cannot access this info from my main function without making the vector public or make a return statement from the printShapes() function, which will make the code messy and not intuitive as I want it to be.

So my question is: Is there a way to find the size of the vector at the Menu function from the main function without making the changes I stated above? Because in the end I want to be able to just do `menu.printShapes()` and then let the user to choose the index of the shape that he wants to change

this is my main function as of now:

```

    Menu menu;
    int input = 0, wait = 0;
    while (input != 4)
    {
        cout << "1: Add New Shape: " << endl;
        cout << "2: Modify Existing Shape: " << endl;
        cout << "3: Delete All Shapes: " << endl;
        cout << "4: Exit: " << endl;
        while (input < MIN || input > MAX)
        {
            cin >> input;
            cin.ignore(numeric_limits<streamsize>::max(), '\n');
            std::cin >> wait;
        }
        switch (input)
        {
            case 1:
            {
                cout << "1: Circle: " << endl;
                cout << "2: Rectangle: " << endl;
                cout << "3: Triangle: " << endl;
                cout << "4: Arrow: " << endl;
                while (input < MIN || input > MAX)
                {
                    cin >> input;
                    cin.ignore(numeric_limits<streamsize>::max(), '\n');
                    std::cin >> wait;
                }
                menu.createShape(input);
            }
            case 2:
            {
                /*
                I want to be able to access the size of the vector from here
                So I could do something like that:
                menu.printShapes();
                while (input < 0 || input > vectorSize)
                {
                    :Get the index of the shape that the user wants to modify
                }
                Instant of doing
                size = menu.printShapes();
                */
            }
        }
    }

```