Archived

This topic is now archived and is closed to further replies.

thehurricane

writing classes with static members to a file

Recommended Posts

yes they will if you type

file.write(reinterpret_cast(&Class::staticMember), sizeof(Class::staticMember));

It's kinda hard to guess how you're using file.write()...

[edited by - civguy on January 19, 2003 4:14:00 PM]

Share this post


Link to post
Share on other sites
Try this:

  
#include <iostream>

class A {
public:
static int a;
};

int A::a = 1;

int main() {
std::cout << sizeof(A) << ''\n'' << sizeof(int) << ''\n'';
}

and do your own deductions

Share this post


Link to post
Share on other sites