Lecture overview -- Keyboard shortcut: 'u'  Previous page: Abstract Classes -- Keyboard shortcut: 'p'  Next page: What about nested classes in C++? -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 4 - Page 9 : 24
Notes about C++
Abstraction Mechanisms, Part 2
What about interfaces in C++?

Interfaces are well-known from Java and C#, but they do not appear in C++

  • Why do Java and C# have Interfaces?

    • Because Java and C# do not support multiple inheritance

    • Interfaces are the poor man's remedy for not having multiple inheritance

  • How do we make an Interface in C++?

    • Program a class with only pure virtual functions

y:/Kurt/Files/Advanced-programming-cpp/c-sharp/interfaces/gameobject.csA sample C# interface.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/virtual-member-functions/interface-like-class.ccThe C++ counterpart to the C# Interface.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/virtual-member-functions/interface-like-class-and-use.ccA C++ class that 'implements the interface' and uses the resulting class.