I am using Ubuntu terminal g++ compiler for this , its hard for me to debug
Here is my code : S.h
 class S
    {
    protected: 
        string name;
        bool space;
    public:
        S();
        S(string,bool);       
        void setName(string name);
    string getName();
};
In my S.cpp
string S::getName() 
{   
    return (name);  
}
void S::setName(string name) // I tried to change to other variable names but gave me segmentation errors
{
   name = name;
}
S::S() // default constructor
{
    name = "";
    space = true;
}
    S::S(string name, bool space) // non-default constructor
{
        name = name;
        space= space;
    }
I got another class which I am going to implement the flow In my Main.cpp
    void Main::mainmenu()
{
    //cout displays//
    cout<<"Please input your choice: ";
    cin>>choice;
    option(choice);
}
    void Main::option(int choice)
{
    static string shapename;
    static bool space;
    const int size = 100;
    static S s[size];
    static int number =0;
    static int count = 0;
    while(choice !=999)
    { 
        switch(choice)
        {
            case 1: 
            {
                cout<<"Please enter name of Shape:";
                cin>>shapename;
                s[size].setName(shapename);
                cin.clear();
                cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
                  count++;
                mainmenu();
                cin>>number;
                option(number);
            }
            break;
            case 2:
            {
                 for(int x = 0;x<count;x++)
                {   
                    cout<<count<<endl;
                    cout<<shapename<<endl; // this is to test if the string reaches case 2 and it displays the correct input
                    cout<<s[x].getName()<<endl; // however this method prints a blank.
                }
                mainmenu();
                cin>>number;
                option(number); 
            }
            break;
            default:break;
        } // end of switch      
    } // end of while  
}
I am just running mainmenu() in my int main() 
I am trying to do a switch case on my main.cpp whereby the case 1 I get user to input the name they want and I use set method from class S to get the name , and in my case 2 , I want to retrieve and print out the name the user input by using get method .
I have put static infront of my delcarations because I thought the invocations might affect the values .
How can I retrieve my get/set methods with switch case statement ? I am using Ubuntu terminal to do this its very difficult for me to see what values are being passed in.
 
     
    