Professional Documents
Culture Documents
Exp - 1
Exp - 1
these components collectively empower our C++ program to communicate with users, format output
neatly, manage dynamic arrays efficiently, and maintain code clarity.
As you can see here there is a word public called acsess modifier, this access modifier specifies that
the members declared after it are accessible from outside the class. It means that other parts of the
program can access and modify these variables.
These are the member variables that store information about the elementary student, Parent
Information, and Additional information for returning/transferee status.
int is used for integer (whole number) data types that’s why we use int in schoolYear, age, house
number, zip code , psaBirthCertificateNumber, learnerReferenceNumber, and contact number
variables .Then string is used for storing sequences of characters or numbers, that’s why we used
string function in Last name
First name
Middle name
Birthdate
Sex
Place of birth
Religion
Citizenship
Sitio/Street Name
Barangay
Municipality
Province and ;
Country variables
In Here, a nested struct named Parent is defined to store information about a student's parents.
father and mother are instances of the Parent struct, representing the student's father and mother,
respectively.
- This line declares the constructor for the `ElementaryStudent` class. The constructor has the same
name as the class and is called when an object of the class is instantiated.
This constructor is responsible for initializing the member variables of an object of the
ElementaryStudent class with default values.
- This colon `:` starts the member initialization list. It initializes the member variables of the class
with specific values.
- Each member variable is followed by a value in parentheses, indicating the default value for that
variable.
- The semicolon at the end (`};`), marks the end of the class definition and the constructor
implementation.
- Semicolons are used to terminate statements or declarations.
- the Quotation marks are used to represent an empty string.
- The open curly bracket, `{` marks the beginning of the constructor body, and the closing curly
bracket , `}` marks its end. Everything between these braces constitutes the constructor
implementation.
Then - Parentheses are used to enclose the values provided for initializing the member variables.
As you can see here there is a word private this is a type of access modifier, this is used to designate
members (variables and functions) that are only accessible within the class itself. Anything declared as
private cannot be accessed directly by code outside the class.
4. `string getSection();`: This function is used to get the selected section from the user. Marking it as
private ensures that only the class's member functions can call this function, controlling how the
section information is obtained.
By making these members private, the class is enforcing encapsulation, which helps maintain the
integrity of its internal state and provides a clear interface for external code to interact with the class.
External code can use public member functions to interact with the class while the internal
implementation details, like the enrolled students vector and certain display functions, are hidden.
public:
void enrollElementaryStudent();
void displayEnrolledStudents();
```
-there Two public member functions are declared: `enrollElementaryStudent` and
`displayEnrolledStudents`. These functions are accessible from outside the class that’s why it is
under the public access modifier.
- `enrollElementaryStudent`: Represents a function to enroll an elementary student.
- `displayEnrolledStudents`: Represents a function to display information about enrolled students.