Lecture overview -- Keyboard shortcut: 'u'  Previous page: Organization of classes and members -- Keyboard shortcut: 'p'  Next page: Functions outside classes -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 3 : 36
Notes about C++
Abstraction Mechanisms, Part 1
Classes, structs and namespaces

Structs and classes are similar in C++

A class/struct is a namespace "with some extra properties":

  • The C++ Programming Language: Page 234,849
 

  • Class

    • Defines a named type where members are private by default

    • Typically used for user-defined types

    • A namespace "with some extra properties":

  • Struct

    • Defines a named type where members are public by default

    • Typically used for aggregation of public data

    • A namespace "with some extra properties":

  • Namespace

    • A scope

    • Named or unnamed

    • Global

 

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/structs/point2.ccStruct Point in C++ .


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/namespaces/point-namespace-1.ccA namespace with struct Point in C++ .


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/namespaces/point-namespace-2.ccSame with illustration of ambiguities relative to the global namespace.