Classes and Objects: Constructor, Destructor, This Pointer, Pointer As Members, Arrays of Objects
Classes and Objects: Constructor, Destructor, This Pointer, Pointer As Members, Arrays of Objects
Delivery Component (30 minutes) 1. 2. 3. 4. Classes - attributes and behavior private and public access specifiers Use of constructor and destructor Notions of struct and class in C++.
Experiment/Hands-on Practice (60 minutes) Q1. Identify classes and objects of that class near the area where you are sitting. Create a program of any one class which you have identified, check what all attributes that class has and how that class behaves and create objects of that class. Q2. Create a class of student, think and list the attributes of student and use relevant constructor and functions to execute on that data. Make a single object of this class and enter your details in it. Q3. In your section, suppose there are 60 students so convert the above program for entering data of 60 students. Q4. Create a program for employees of your company with data members for employee id, employee name, employee designation, basic salary, ta, da and total number of leaves taken. Initialize the value of these data members at the time of object creation and then calculate total salary to be paid as basic salary + ta + da - total number of leaves taken * 500. Then display the details of employee and total salary to be paid. Q5. You are probably wearing on your wrist one of the worlds most common types of objectsa watch. Discuss how each of the following terms and concepts applies to the notion of a watch: object, attributes, behaviors, class, encapsulation, information hiding. Q6. Implement the Date class with suitable data members and implement functionality to perform error checking on the initializer values for data members month, day and year. Also, provide a member function nextDay() to increment the day by one.