0% found this document useful (0 votes)
4 views5 pages

Object-Oriented Programming LAB # 3

The document outlines an OOP lab experiment focused on classes and objects in C++. It includes objectives, lab tasks involving the creation of classes and methods in C++, and assessment criteria for both lab conduct and lab reports. The conclusion emphasizes the importance of encapsulation, data abstraction, and the role of classes and objects in programming.

Uploaded by

Anus Babar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Object-Oriented Programming LAB # 3

The document outlines an OOP lab experiment focused on classes and objects in C++. It includes objectives, lab tasks involving the creation of classes and methods in C++, and assessment criteria for both lab conduct and lab reports. The conclusion emphasizes the importance of encapsulation, data abstraction, and the role of classes and objects in programming.

Uploaded by

Anus Babar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

BCE-2A OOP LAB

AIR UNIVERSITY

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING


EXPERIMENT: 03

Lab Title: Introduction to Classes & Objects

Student Name: Reg. No:

Objectives:
• To understand what is an Abstract Data Type
• To understand and use class, object, object instance and message.
• To understand the basic principles of data hiding and encapsulation.
• To understand and use keyword public and private.
• To understand the use of scope resolution operator.

LAB ASSESSMENT:

Excellent Good Average Satisfactory Unsatisfactory


Attributes
(5) (4) (3) (2) (1)
Ability to Conduct
Experiment
Ability to assimilate
the results
Effective use of lab
equipment and follows
the lab safety rules

Total Marks: Obtained Marks:

LAB REPORT ASSESSMENT:

Excellent Good Average Satisfactory Unsatisfactory


Attributes
(5) (4) (3) (2) (1)

Data presentation

Experimental results

Conclusion

Total Marks: Obtained Marks:


Date: Signature:

Submitted To: Engr. Sidrish Ehsan


Date: 10-3-2025
Page | 1
BCE-2A OOP LAB

LABORATORY
EXPERIMENT NO.3

Lab Task 01:


Write C++ code fragments for the following:
a. Declare a class Date with data members day, month, and year.
b. Declare two objects of class Date.
c. Declare an object of class Date, a pointer to Date and an array of 10 Dates.

Page | 2
BCE-2A OOP LAB

Lab Task 02:


Write a complete C++ program with the following features.
a. Declare a class Point with two integer data members x and y.
b. Provide appropriate constructors to initialize the data members.
c. Provide separate get (get X(), get Y()) and set (set X(), set Y()) methods for each of the data
members.
d. Provide a method display() to print the x and y coordinates.
e. In the main(), declare two objects of Point and call the method display() for each of them.
Change the values of x and y using the set() functions.
f. From main(), call the functions getX() and getY() for each of the points, add the x and y
coordinates together and print the result.

Page | 3
BCE-2A OOP LAB

Lab Task 03:


Define a class Circle with its radius and center (x, y) as data members. Provide set & get methods
to compute the area and circumference of the circle. Call these methods from the main() program.

Page | 4
BCE-2A OOP LAB

CONCLUSION

• The use of classes in C++ enables encapsulation and data abstraction, allowing for better
organization and modularity in programming.

• Objects help in structuring code efficiently by grouping related data and behaviors, making
programs more maintainable and scalable.

• Implementing getter and setter methods ensures controlled access to private data members,
enhancing security and data integrity.

• Understanding classes and objects is fundamental for developing real-world applications such as
simulations, game development, and complex software systems.

Page | 5

You might also like