MMath&Phys Mathematics and Physics / Course details

Year of entry: 2024

Course unit details:
Object-Oriented Programming in C++

Course unit fact file
Unit code PHYS30762
Credit rating 10
Unit level Level 3
Teaching period(s) Semester 2
Available as a free choice unit? No

Overview

Object-Oriented Programming in C++

Pre/co-requisites

Unit title Unit code Requirement type Description
Introduction to Programming for Physicists PHYS20161 Pre-Requisite Recommended

A working knowledge of programming at the level of PHYS20161 and an interest in programming.

Aims

  1. To learn the fundamentals of Object Oriented Analysis and Design.
  2. To become fluent in the C++ programming language.
  3. To develop good programming style.
  4. To be able to apply coding quickly and efficiently to realistic applications.

Learning outcomes

This course unit detail provides the framework for delivery in 21/22 and may be subject to change due to any additional Covid-19 impact.  Please see Blackboard / course unit related emails for any further updates
On completion successful students will be able to:-
1. Write C++ code that is compact and intelligible
2. Design and write programs in C++ using a wide range of ANSI standard features
3. Locate data structures and algorithms in the standard library to simplify coding
4. Select and use appropriate object-orientation techniques to solve new problems

Syllabus

1. The basic properties of C++: constants; boolean data-types; pointers and references; dynamic memory allocation; function overloading.

2. Data streams: standard input/output; managing files.

3. Classes and objects: encapsulation; access functions; constructors and destructors; arrays of objects; friends; operator overloading; assignment operator; shallow and deep copying; this pointer. Move semantics.

4. Inheritance: base and derived classes; access specifiers; overriding functions; multiple inheritance.

5. Polymorphism: base class pointers; abstract base classes; virtual and pure virtual functions; interface classes.

6. Structuring programs: header files; multiple source files; namespaces.

7. Advanced C++ features: static data; templates; runtime type checking; error handling and exceptions. 

Lambda closures.

8.The C++ Standard Library; the boost library; other libraries.

Assessment methods

6 short coding assignments, marked on code quality; One larger coding project with a short report.

Standard late penalties apply for all assessments 

Feedback methods

Written feedback will be offered for the short assignments, and demonstrators will be available to give additional oral feedback on the short assignments. Written feedback will be provided with final project marks.

Recommended reading

A. Koenig and B. E. Moo. Accelerated C++ (Addison Wesley, 2000)
Or any of the many C++ textbooks listed in the library reading list

Study hours

Scheduled activity hours
Lectures 10
Practical classes & workshops 10
Independent study hours
Independent study 80

Teaching staff

Staff member Role
Caterina Doglioni Unit coordinator
Charanjit Kaur Unit coordinator

Return to course details