Topic: C++/C copatibility


Author: roman@hri.com (Roman Budzianowski)
Date: 6 Dec 90 19:55:41 GMT
Raw View
Yes, I read the ARM, but would like to hear your opinion.

I want to interface to a binary C library from C++. The C library
creates "objects" of the following structure:

struct part1 {
 atype1 a;
 atype2 b;
};
struct object1 {
 struct part1 A;
};

struct part2 {
 atype c;
};

struct object2 {
 struct part1  A;
 struct part2  B;
};

Assume the types atype{n} are primitive.

Can I access those "objects" from C++ using the following class definitions:

class object1 {
 atype1 a;
 atype2 b;
};

class object2 : public object1 {
 atype c;
};


It works fine in g++ and cfront 2.0, but a comment in ARM got me confused.
I am not using virtual functions.

Thanks.