Possible Duplicate:
Code convert from C++ to C
Converting a C++ class to a C struct (and beyond)
I used to be a C++ programmer, but now I need to write a program in C. e.g. in C++
Main.cpp
=====================
int main
{
ns::Sum sum(1, 2);
}
Sum.h
=====================
namespace ns
{
class Sum
{
public:
Sum(int a, int b);
private:
void AddThemUp();
int a;
int b;
}
}
Sum.cpp
======================
namespace ns
{
Sum::Sum(int a, int b)
{
this->a = a;
this->b = b;
AddThemUp();
}
void Sum::AddThemUp()
{
a + b;//stupid for returning nothing, just for instance
}
}
That's in C++ I don't know how to put above in C. because there is no class there. if I declare data member a & b in header file, they will become global variables. I don't like global variables. and is there namespace in C? who can help? thank you