mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-12 12:13:58 +02:00
Fix data type content (#4381)
data type (struct and class) clarification
This commit is contained in:
committed by
GitHub
parent
538e41307c
commit
eea79968e2
@@ -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
|
||||||
|
Reference in New Issue
Block a user