Object Oriented Systems - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Object Oriented Systems

Description:

Today we will be summarising what we have covered and what you need to know ... an understanding of what is happening under the bonnet when you pass parameters. ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 31
Provided by: scie205
Category:

less

Transcript and Presenter's Notes

Title: Object Oriented Systems


1
Object Oriented Systems
  • Lecture 19 - Revision

2
Praise be the Bjarney!
  • Today we will be summarising what we have covered
    and what you need to know for the exam.
  • Much of what you have learnt in the courseworks
    will hold you in good stead.
  • However the following slides will indicate what
    you specifically need to know. Items in BLUE will
    NOT come up in the exam. Items in RED may well.

3
The Man Himself, and
4
not Bjarne
5
Lecture 1 The Basics
  • Java Bashing
  • Setting up G
  • Variables
  • Operators
  • Decisions
  • Loops
  • These are all fundamentals and you should
    make sure you know the syntax. This is NOT an
    open book exam.

6
Lecture 2 Linking and IO
  • What makes up a C program
  • How to compile your code with g
  • Linking
  • Basic Input / Output (IO)
  • Keyboard IO
  • A word on style
  • Again basics like cin but the crucial aspects
    of this are to make sure you have an
    understanding of program structure and the
    linking process. Also remember how cout deals
    with pointers as parameters.

7
Lecture 3 Functions Parameters
  • Functions
  • Parameters, Scoping Returns
  • Recursion
  • Function Overloading
  • Passing by Value or Reference?
  • Passing by pointers
  • Procedural programming is an essential
    grounding block for a software engineer. Equally
    you must have an understanding of what is
    happening under the bonnet when you pass
    parameters.

8
Lecture 4 Arrays Strings
  • Single Dimensional Arrays
  • Multi Dimensional Arrays
  • Arrays as Parameters
  • C-Style Strings The Null Terminator
  • String Manipulation
  • C String Object
  • You should never really be using arrays in
    new code. They are inflexible and the source of
    many bugs. However you must be able to understand
    them. The same applies to c-strings.

9
Lecture 5 - Pointers
  • Pointers to Pointers to Pointers
  • Pointers and Arrays
  • Command Line Arguments
  • Pointer Arithmetic
  • Structures
  • Pointers are a fundamental of C. Even with
    the use of items like auto_ptr you need to know
    what is happening. They are everywhere in
    programming (even Java). Also remember command
    line arguments include the name of the program.

10
Lecture 6 - DMA
  • The Stack and the Heap
  • Dynamic Memory Allocation
  • New and Delete
  • More Pointer Pitfalls
  • Again this is about what is going on just
    underneath the surface. It is crucial that you
    understand these concepts, and the difference
    between the Stack and the Heap.

11
Lecture 7 Declarations Classes
  • Namespaces
  • Headers
  • Classes in C
  • You must understand namespaces this should not
    be a problem if youve looked at cwk2. Similarly
    this module is about Object Orientation master
    the C class syntax.

12
Lecture 8 - Classes
  • C Class Structure
  • Constructors
  • Member Functions
  • Default Arguments
  • DMA in Classes
  • Passing Objects to and from Functions
  • Inline and Friend Functions
  • Again fundamentals of OO. You must understand
    constructors and destructors completely.

13
Lecture 9 Class Copying
  • Shallow and Deep Copy
  • Copy Constructors
  • Destructors
  • Operator Overloading
  • Overloading
  • Shallow and Deep Copying is such a source of
    memory leaks and bugs it is vital you are always
    conscious of it. Equally operator overloading is
    a key part of C flexibility.

14
Lecture 10 - Inheritence
  • Initialising class variables in the constructor.
  • What is Inheritance?
  • Protected Members.
  • Multiple Inheritance.
  • Constructors in Inheritance.
  • Here we started to get into more complex areas.
    As you should be seeing with Cwk2, an
    understanding of these is crucial however in
    Object Oriented Systems.

15
Lecture 11 Loose Ends
  • Virtual Functions
  • Streams Formatting flags
  • File I/O
  • String Streams
  • Basic Preprocessor Directives
  • Debugging with __LINE__ and assert().
  • There was a lot in this lecture. Virtual
    functions must be understood especially, but all
    of these topics must be in your C armoury.

16
Lecture 12 More C
  • Exceptions
  • Using them
  • Creating your own
  • Template Functions
  • Exceptions are an essential part of modern
    C and must be well understood.
  • Templates formed the basis for the remaining
    lectures. You need to know their syntax! Their
    static (compile time) nature is a concept that
    needs understanding..

17
Lecture 13 STL
  • Template Classes
  • STL Overview
  • Template classes are another part of the C
    syntax that you need to know.
  • The advantages and disadvantages of each
    container were discussed in this lecture. The
    correct container choice is a fundamental part of
    using the STL.

18
Lecture 14 STL - Iterators / Range
  • Iterators
  • Ranges
  • Calculation of ranges, with unknown positions
  • Non Manipulating Algorithms
  • Iterators are the glue between containers and
    algorithms. Their interface and usage need to be
    known.
  • The STLs method of defining ranges (past the
    end iterator).

19
Lecture 15 STL - More Iterators
  • Iterator adapters
  • Manipulating Algorithms
  • The usage of iterator adapters is something you
    need to be aware of, but they are not in the
    exam
  • Manipulating algorithms are a core part of the
    STL, you should know how they work.

20
Lecture 16 Functions Fn Objects
  • User defined functions
  • Function Objects
  • Predefined Function Objects
  • bind2nd
  • Requirements for container elements
  • Boost
  • We covered a lot here. Some you need to
    know, some you dont.

21
Lecture 17 Smart Pointer
  • stdauto_ptrltTgt
  • A lecture with a small title, but there was a
    lot in it as there are many issues associated
    with this feature. You need to know about the
    usage, and the subtleties of using such a smart
    pointer .

22
Lecture 18 C Casting
  • static_cast
  • const_cast
  • dynamic_cast
  • reinterpret_cast
  • Without giving too much away, then casting may
    be worth reading up on Its also a fundamental
    language feature which must be understood by any
    C programmer.

23
The Exam
  • This will be in a similar style to the G6DICP
    exam set by Tim last semester.
  • Answer ALL 25 Questions.
  • Questions worth 2 - 5 marks each.
  • 2 hours long.
  • NO Text Books Allowed.

24
Example Question 1
  • To handle unexpected errors traditional C
    programming used a return code (sometimes called
    an error code) that the caller explicitly tests
    via a conditional statement such as if. What
    are the advantages of using the C exception
    syntax (try/catch/throw) over this approach? 3
    marks

25
Example Question 2
  • Imagine you are writing a number converter that
    converts from a hexadecimal string (base 16) to
    an integer. In hexadecimal numbers 0-9 are the
    same but A, B, C, D, E and F represent values 10
    to 16 respectively. For example
  • 01 1,
  • 0A 10,
  • 0F 15,
  • 10 16,
  • 1B 27
  • State which STL container would assist you the
    most in the conversion of the hexadecimal strings
    to an integers and explain why.
  • 3 marks

26
Example Question 3
  • What is printed to screen by the following
    program segment?
  • for (int i0 ilt 2 i)
  • cout ltlt ltlt endl
  • for (int j0 jlt 2 j)
  • cout ltlt -- ltlt endl
  • cout ltlt nn ltlt flush

27
Example Question 4
  • (i) What is the purpose of prototypes in C?
  • (ii) Give the prototype for the following
    function
  • int foo(int i, float f, String shello)
  • cout ltlt s ltlt endl ltlt i ltlt endl ltlt f
  • return int(fi)

28
Example Question 5
  • Consider the following statements about template
    functions
  • 1 They can accept more than one ltclass typegt
  • 2 They can be overloaded just as you would a
    normal function
  • 3 They can not use fundamental types only
    classes
  • Which of these statements are true?
  • (a) 1 and 2
  • (b) 2 and 3
  • (c) 1 and 3
  • (d) all of them

29
Any Questions?
  • About C ?
  • The Exam ?
  • The Coursework ?

30
Thats It!
  • Labs will continue until the coursework deadline
    (except where there is an exam).
  • Stefans Wednesday lunchtime sessions also
    continue.
  • Remember the discussion board.
  • Good Luck!
Write a Comment
User Comments (0)
About PowerShow.com