Lecture 5
LECTURE 5:
Abstraction Mechanisms, Part 2
Kurt Nørmark
Department of Computer Science, Aalborg University
Title page
Abstract
References from this lecture
Exercises in this lecture
Source programs in this lecture
Page 1
Inheritance
Page 21
Is repeated inheritance possible?
Page 2
Inheritance in C++
Page 22
Is repeated inheritance possible? No!
Page 3
Inheritance: Constructors and destructors
Page 23
Member access: private, public and protected
Page 4
Examples of inheritance: Constructors and destructors
Page 24
Base class access: private, public and protected
Page 5
Inheritance: Copying and slicing
Page 25
Base class access
Page 6
Virtual Functions
Page 26
Base class access - the C++ rules
Page 7
Examles with virtual functions
Page 27
Base class access - Examples
Page 8
Destructors and Inheritance - Virtual Destructors
Page 28
Discussion: No single most general class in C++
Page 9
Hiding inherited names
Page 29
Templates
Page 10
Abstract Classes
Page 30
Templates - overview
Page 11
What about interfaces in C++?
Page 31
Templates versus generics in Java, C# and C++
Page 12
What about nested classes in C++?
Page 32
Class templates in C++
Page 13
What about prevention of derivation in C++?
Page 33
Example - Point<C>
Page 14
Pointer to members
Page 34
Example - Point<C,dim,default_value>
Page 15
Multiple Inheritance
Page 35
Function templates
Page 16
Multiple inheritance - issues
Page 36
Policies with Templates
Page 17
Multiple inheritance - issues and C++ solutions
Page 37
Example of Policies with Templates
Page 18
Multiple inheritance: Ambiguities
Page 38
Template Specialization
Page 19
Replicated base class
Page 39
Example - Specialization of Point<C> to Point<char>
Page 20
Shared base class: Virtual bases
Page 40
Specialization of class templates - complete and partial
Generated: Tuesday August 1, 2017, 13:30:41