Static class object as class member

Hi,
I am trying to create a static object of a class b as a member of a class c. But I keep getting errors. What I do is simply declare it private in class c like this "b obj;" and I try to use the methods of b inside c. Can you help me? When I declare the object as global everything works fine.

Thanks in advance.
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/topic/com.ibm.xlcpp8a.doc/language/ref/cplr038.htm

To summarize the above link, you have to define the static member outside the class:

class_c.hpp
1
2
3
4
5
6
#include "class_b.hpp"

class c {
private:
    static b obj;
};


class_c.cpp
1
2
3
#include "class_b.hpp"

b c::obj;

Thank you very much.
Topic archived. No new replies allowed.