Sign in to follow this  

Creating classes

This topic is 2319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[url=http://www.gamedev.net/page/resources/_/reference/programming/languages/c-and-c/organizing-code-files-in-c-and-c-r1798]Organizing code files in C and C++[/url]. Also:

[code]
// File:"foobar.h"
#pragma once

// foobar dependencies
#include <string>
class foobaz; // forward declaration

class foobar {
public:
void frobnicate( foobaz& f ); // prototype

private:
int a_;
std::string name_;
static int id_;
};


// File:"foobar.cpp"
#include "foobar.h"
#include "foobaz.h"

int foobar::id_ = 0; // symbol definition

void foobar::frobnicate( foobaz& f ) { // definition
f.impl( a_, name_ );
}
[/code]

Share this post


Link to post
Share on other sites

This topic is 2319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this