padraic.xyz

Keyword Glossary

class:

Used either to begin the definition of a class, or in templates to denote the template variable. Note that typename can also be used in the template case, but class will work.

public :

Used in class definitions. Public methods and variables can be accessed anywhere in the programme. They are accessed using . notation, e.g. class.PublicVariable .

private:

Used in class definitions. Private methods and variables are only accessible by this class.

protected :

Used in class definitions. Protected methods and variables can be accesed by this class and any derived classes.

typename:

Used in template definitions to define the placeholder types, and should preferably be used instead of class.

typedef:

Used to create a shorthand name for a commonly used template type, or to name a struct that you have defined (in C). This allows us to for example change a datatype without having to change every instance in the file. Consider using typedef to shorthand an iterator type, typedef iter std::map<std::string, double>::iterator. If we instead wanted a map of complex variables, we need only change the typedef line.

auto:

Used in C++11 to specify a situation where the compiler could infer the type required, for example to clean up the syntax of instantiating an iterator on a template container.