Creating classes
Is there any way that i can create a class in a seperate file because creating it all in one file gets really confusing. Also can i do this with functions as well? If so how?
Organizing code files in C and C++. Also:
// 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_ );
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement