I want to know how can i convert a "typedef struct" in objective C to a c++ code preferably make into a class. is it possible ? can i used classes ?
Example :
typedef struct{
int one;
int two;
}myStruct;
There is no fundamental difference between struct and class in C++*. This is a type mystruct with two public data members:
struct mystruct {
int one;
int two;
};
This is exactly the same type as
class mystruct
{
public:
int one;
int two;
};
* The difference is that members and base classes are public by default in a struct and private in a class. The two keywords can be used to express the same types.
class Foo { int i; }; and struct Foo { private: int i; }; for example.class types are default PRIVATE, while struct members are default PUBLIC.First of all, all that standard stuff about reading some good books on C++ applies.
In C++, structs ARE classes, the only difference is the default visibility of class members AND that no typedef is necessary for these objects, myStruct is automatically useable as if you typedef'd it. Thus you would have:
struct myStruct {
int one;
int two;
};
and you can add member functions and all that on top of this. Plain Old Data (POD) structs are also fine in C++.