About

Big Bad Robots is an indie game developer but we also do contract development. We have developed on all kinds of platforms (PC,Handheld,Consoles) but now primarily focus on iOS,Android and Unity. Contact us if you looking for developers with over 20 years experience in software and game development at biz -at- bigbadrobots.com

Formating your class header…

September 12, 2009terence

This is more of a note to self about how to format a C++ header file based on what I think is important:


class MyClass

{

public:

<Public defined enums and constants>

public:

<Public variables OR Get/Set functions. Public variables are frowned upon anyways>

public:

<Public defined interfaces and constructors

private:

<Private variables>

private:

<Private functions>

};

The basic rules of thumb are:

  • Public interfaces are on top because that is the first thing programmers reading your code want to know without scrolling down through the rest of the file.
  • Protected interfaces follow
  • Private interfaces are last (and often don’t change)
  • Be consistent
  • Use white spaces
  • Split up constants, variables and interfaces with seperate “public/protected/privates”s

Leave a Reply

Your email address will not be published. Required fields are marked *