Programmering i C++

On this page, you'll find material relevant to our internal course in C++ programming.

If you want the class that made boxslides, get it here (boxslides.cls).

You can also obtain the code via HEHIs CVS repository. The commad is:

  cvs -d /hehi13/hehi/hehi_cvs checkout oocourse/session<num>

where <num> is the session your intrested in.

1. Session

Overview

This session wil try to give some motivation for classes and objects. Also, we'll see how to declare and define classes, and how to make objects of classes. We'll briefly encounter pointers. Finally we'll use the privous in a short ROOT session.

Topics

  • Introduktion to classes and objects.
  • Pointers
  • Small ROOT session

Materials

Transperancies in English (PostScript)
Paper in English (PostScript 2 per page)
Transperancies in Danish (PostScript)
Paper in Danish (PostScript 2 per page)
C++ code (tar archive)

Top of page

2. Session

Overview

We'll start by simplifing our Particle from the last session, by using constructors, inline methods, and more classes. We'll make a new class representing a magnet, and send particles through such a Magnet object.
In the course of this session, we'll see howt to split our code into smaller parts, and how to combine them into a program.

Topics

  • `Constructor's (and a bit about `destructor').
  • inline methods.
  • Keyword operator
  • Multiple classes
  • Seperate compilation of source code (Not done)
  • `Makefile's (not done)

Materials

Transperantcies in Danish (PostScript)
Papier in Danish (PostScript 2 per page)
C++ kode (tar arkiv)

Top of page

3. Session

Overview

Due to poor participation last session, and some techincal deficulties, the contents of this session will be the same as session 2.

Topics

  • (Resumé) `Constructor's (and a bit about `destructor').
  • (Resumé) inline methods.
  • (Resumé) Keyword operator
  • (Resumé) Multiple classes
  • Seperate compilation of source code
  • `Makefile's

Materials

The material of this sessio is the same as for session 2 (see above).

Top of page

4. Session

Overview

We'll continue with our Particle and Magnet classes, and add a Hodoscope class. This leads to inheritance, which is a crucial point in Object Orienteret Programming.

We'll get to a sort of Mini Geant, where we are free to add any kind of detector, order hieracily to arbiteary depths.

The code for Mini Geant, and the HTML docuumentation, made by ROOT, is avaliable here.

Topics

  • Inheritance
  • Virtual methods

Materials

Transperantcies in English (PostScript)
Paper in English (PostScript 2 per page)
Transperantcies in Danish (PostScript)
Paper in Danish (PostScript 2 per page)
C++ kode (tar arkiv)
MiniGeant (tar arkiv)

Top of page

Links

There are a lot of stuff on C++ on the web, so I've only listed those I find reasonabley good myself.

  • Corando Enterprises C++ tutorial (On-line PostScript) OK tutorial. presupposes som prior knowledge of C, but not a lot
  • Introduction to Object-Oriented Programming Using C++ (On-line, HTML, PostScript) A pretty good introduction to Object Orienteret Programmering. Presupposes knowledge of programming in C, Pascal, Fortran, or similar. Also, C++ ins't really explained. Emphasis is on Object Orienteret Programmering.
  • C++ Annotations (On-line, HTML, PostScript, PDF, LaTeX) Very good, but presupposed knowledge of C. Very good as a refernece manual when you've gotton aquinted with C++.
  • C++ Basics for ROOT User (On-line) Short introduction to basic C++, using ROOT. It's a good introduction to ROOT also. Demands no prior knowledge of either ROOT or C++.
  • Getting Started with ROOT (On-line). Demands knowledge of C++. Nice introduction to TTree
  • GNU Compiler Collection (A.k.a. GCC) (Swedish mirror) contain information on the iostream classes.
  • GNU C Library (A.k.a. libc6 or glibc) is documentet On-line or as a PostScript file.
  • The Java Tutorial (On-line). Contain many nice points on Object Oriented Programming in general. Java isn't C++, far from it, but the similarities are plentyfull, so that many of the considerations are also valid for C++. Where Java and C++ differs, it is noted in the text. It's a rather long text, so browse it you want some more details of the concepts of Object Oriented Programming.

Top of page

Other stuff

This course was given by Anders Holm (e-mail: aholm@nbi.dk) and Christian Holm (e-mail: cholm@nbi.dk).

Top of page