4. Variables and access specifiers.
Hello folks!
Welcome to the blog series. In the previous blog we have studied why we have chosen c++ language for object oriented programming (OOP) and our approach to the project. In this blog we are going to look at the variables to be used and types of these variable.
As our project is building for cafeteria management system. We require certainly to understand first the table number where one is placing order from. Hence an integer array of the number of table present in the cafeteria. To take the order of available items in the cafeteria such as “Hot Coffee”, “Tea”, “Hot Milk”, “Cold Coffee” we made character array of name and assigned each character pointer to character array of payOption so it will be easier for the waiter who is taking the order to place the order. These items are assigned each int variable of price. To place multiple orders integer quantity variable is used. This quantity variable is multiplied with the price variable. To know the bill of the table integer bill is made which displays bill of the table.
Classes have the same format as plain data structures, except that they can also include functions and have these new things called access specifiers. An access specifier is one of the following three keywords: private, public or protected. These specifiers modify the access rights for the members that follow them:
Private members of a class are accessible only from within other members of the same class (or from their "friends").
Protected members are accessible from other members of the same class (or from their "friends"), but also from members of their derived classes.
Finally, public members are accessible from anywhere where the object is visible.
These classes helps us in our project too as price, quantity and the bill is made private so these variables cannot be changed by anyone.
In next blog of the series we will discuss about classes and different types related to it
By-
Ashutosh Bardapurkar (k-05)
Hrishikesh Deshpande (k-16)
Archit Hiwrekar (k-23)
Chinmay Kapkar (k-33)
Nice work
ReplyDeleteThanks for your feedback
DeleteNicely written
ReplyDeleteThank you sir for your feedback
ReplyDelete