// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class S
{
    private:
        string m_v;
        static vector<S*> all;
    public:
        S(string v);
        string GetV();
        static string GetV(int ix);
};

vector<S*> S::all;

S::S(string v)
{
    m_v = v;
    all.push_back(this);
}

string S::GetV()
{
    return m_v;
}

string S::GetV(int ix)
{
    return all[ix]->GetV();
}

int main()
{
    S s1("abc");
    S *s2 = new S("def");
    cout << s1.GetV() << " " << s2->GetV() << endl;
    cout << S::GetV(0) << " " << S::GetV(1) << endl;
    return 0;
}
