Fix data type content (#4381)

data type (struct and class) clarification
pull/4402/head
Selva Muthu Kumaran 1 year ago committed by GitHub
parent 538e41307c
commit eea79968e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/data/roadmaps/cpp/content/104-data-types/index.md

@ -85,7 +85,7 @@ int& numRef = num;
User-defined data types are types that are defined by the programmer, such as structures, classes, and unions. User-defined data types are types that are defined by the programmer, such as structures, classes, and unions.
## Structures (struct) ## Structures (struct)
Structures are used to group variables of different data types together under a single name. Structures are used to store different data tyes under a single variable and accessibility of member variables and methods are public.
Example: Example:
```cpp ```cpp
@ -99,7 +99,7 @@ Person p1 = {"John Doe", 30, 5.9};
``` ```
## Classes (class) ## Classes (class)
Classes are similar to structures, but they can also have member functions and access specifiers. Classes are similar to structures, but the accessibility of the member data and function are governed by access specifiers. By default access to members of a class is private.
Example: Example:
```cpp ```cpp
@ -131,4 +131,4 @@ union Data {
Data myData; Data myData;
myData.num = 42; myData.num = 42;
``` ```

Loading…
Cancel
Save