|
1 |
| -## C++ object model: declarations |
| 1 | +## C++ object model: Declarations |
2 | 2 |
|
3 | 3 | _Skeleton descriptions are typeset in italic text,_
|
4 | 4 | _so please don't remove these descriptions when editing the topic._
|
5 | 5 |
|
6 |
| -This topic is currently under construction and will soon be filled with information :) |
| 6 | +### Overview |
| 7 | + |
| 8 | +_Provides a short natural language abstract of the module’s contents._ |
| 9 | +_Specifies the different levels of teaching._ |
| 10 | + |
| 11 | +------------------------------------------------------------------------ |
| 12 | +Level Objective |
| 13 | +----------------- ------------------------------------------------------ |
| 14 | +Foundational Declaring variables |
| 15 | + |
| 16 | +Main Declaring for programs |
| 17 | + |
| 18 | +Advanced Special cases and peculiarities |
| 19 | + |
| 20 | +------------------------------------------------------------------------ |
| 21 | + |
| 22 | +### Motivation |
| 23 | + |
| 24 | +_Why is this important?_ |
| 25 | +_Why do we want to learn/teach this topic?_ |
| 26 | + |
| 27 | +* Introduces a name and it’s type |
| 28 | +* `int baz;` |
| 29 | +* `void bar();` |
| 30 | +* `class Foo;` |
| 31 | + |
| 32 | +### Topic introduction |
| 33 | + |
| 34 | +_Very brief introduction to the topic._ |
| 35 | + |
| 36 | +Introduce names and their associated type in a scope. |
| 37 | + |
| 38 | +### Foundational: Declaring variables |
| 39 | + |
| 40 | + |
| 41 | +#### Background/Required Knowledge |
| 42 | + |
| 43 | + |
| 44 | +A student: |
| 45 | + |
| 46 | +* is familiar with the basic C++ types: |
| 47 | + * bool (Boolean type) |
| 48 | + * int (Integer type) |
| 49 | + * double (Floating-point type) |
| 50 | + |
| 51 | +#### Student outcomes |
| 52 | + |
| 53 | +_A list of things "a student should be able to" after the curriculum._ |
| 54 | +_The next word should be an action word and testable in an exam._ |
| 55 | +_Max 5 items._ |
| 56 | + |
| 57 | +A student should be able to: |
| 58 | + |
| 59 | +1. declare a variable with a specific type ‘int baz;’ |
| 60 | +2. declare a function ‘void bar();’ |
| 61 | +3. declare a class ‘class Foo;’ |
| 62 | +4. forward declare a user-defined type or a function |
| 63 | +5. explain the difference between a definition and a declaration |
| 64 | + |
| 65 | +#### Caveats |
| 66 | + |
| 67 | +_This section mentions subtle points to understand, like anything resulting in |
| 68 | +implementation-defined, unspecified, or undefined behavior._ |
| 69 | + |
| 70 | +No caveats at present. |
| 71 | + |
| 72 | +#### Points to cover |
| 73 | + |
| 74 | +_This section lists important details for each point._ |
| 75 | + |
| 76 | +### Main: Declarations for programs |
| 77 | + |
| 78 | + |
| 79 | +#### Background/Required Knowledge |
| 80 | + |
| 81 | + |
| 82 | +* All of the above. |
| 83 | +* Basic template syntax |
| 84 | + |
| 85 | +#### Student outcomes |
| 86 | + |
| 87 | +_A list of things "a student should be able to" after the curriculum._ |
| 88 | +_The next word should be an action word and testable in an exam._ |
| 89 | +_Max 5 items._ |
| 90 | + |
| 91 | +A student should be able to: |
| 92 | + |
| 93 | +1. create header and source files with a declaration in the former and definition of a variable/function in the latter |
| 94 | +2. declare type aliases to introduce a type with an alternative name ‘using std::string;’ |
| 95 | +3. write a forward template declaration |
| 96 | + |
| 97 | +#### Caveats |
| 98 | + |
| 99 | +_This section mentions subtle points to understand, like anything resulting in |
| 100 | +implementation-defined, unspecified, or undefined behavior._ |
| 101 | + |
| 102 | +* Declaring aliases can introduce name clashes |
| 103 | +* Prefer using declaration’s over using directives in header files [link] |
| 104 | +* The order of declarations dictates the order of initialization |
| 105 | + |
| 106 | +#### Points to cover |
| 107 | + |
| 108 | +_This section lists important details for each point._ |
| 109 | + |
| 110 | +### Advanced |
| 111 | + |
| 112 | +_These are important topics that are not expected to be covered but provide |
| 113 | +guidance where one can continue to investigate this topic in more depth._ |
| 114 | + |
| 115 | +* asm declaration |
| 116 | +* using-enum-declaration |
| 117 | +* extern "C" declarations |
0 commit comments