How to move a struct into a class?

Posted by Kache4 on Stack Overflow See other posts from Stack Overflow or by Kache4
Published on 2010-03-28T22:22:57Z Indexed on 2010/03/28 22:33 UTC
Read the original article Hit count: 345

Filed under:
|
|

I've got something like:

typedef struct Data_s {
  int field1;
  int field2;
} Data;

class Foo {
  void useData(Data& data);
}

Is there a way to move the struct into the class without creating a new class? Currently, just pasting it inside the class and replacing Data with Foo::Data everywhere doesn't work.

© Stack Overflow or respective owner

Related posts about c++

Related posts about struct