A simple class for getting and printing a string
<p>I have just started working with classes and in this code I'm trying to have a class which gets a string from the user, counts the length of it and then prints it.
But I'm getting some errors that i can't understand what are they for.
I would appreciate some help.</p>

<pre><code>#include&lt;iostream&gt;

using namespace std;

class String
{
public:
    String();  // constructor
    void Print();   // printing the string
    void Get();     // getting the string from the user.
    int CountLng( char *);   // counting length
    ~String();  // destructor

private:
    char *str;
    int lng;
} str1;


String::String()
{
    lng=0;
    str=NULL;

}


int CountLng( char *str)
{
    char * temp;
    temp=str;
    int size=0;
    while( temp !=NULL)
    {
        size++;
        temp++;
    }

    return size;


};

void String::Get()

{
    str= new char [50];
    cout&lt;&lt;"Enter a string: "&lt;&lt;endl;
    cin&gt;&gt;str;


};


void String::Print()
{
    cout&lt;&lt;"Your string is : "&lt;&lt;str&lt;&lt;endl&lt;&lt;endl;
    lng= CountLng( str);
    cout&lt;&lt;"The length of your string is : "&lt;&lt;lng&lt;&lt;endl&lt;&lt;endl;
};



int main()
{



    str1.Get();
    str1.Print();

    system("pause");
    return 0;
}
</code></pre>
