Slide 5.7: Listing book information (cont.)
Slide 5.9: Constructors and operator overloading
Home

A Stream File


An object is a record stored in memory, whereas a record is that object stored in a file. These few slides investigate the many ways that objects can be represented as records in files. The following interface is the same as the function Enter Book Information in the previous demonstrations, but using constructor and operator overloading.

  Enter Book Information.

  Title:  

  ISBN:  

  Price:  

  Quantity:  







    Password:                    

Constructor
Constructors are special instance methods that are called automatically upon the creation of an object (instance of a class). It instantiates an object, i.e., to name it and initialize it. It has the same name as the class and it has no return type.

Operator Overloading
Use of a single symbol to represent operators with different argument types, e.g., ‘–’, used Another example is ‘+’ used to add