Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
66 views3 pages

Lab Report 3

This document summarizes Muhammad Saim Ashraf's Object Oriented Programming lab assignment. It discusses several tasks involving class scope and accessing class members in C++. The tasks include receiving errors when trying to access private data members from outside the class, making member functions private and using public access functions, creating a private constructor that cannot be called to create objects, and defining a subtraction class with private data members and public member functions to get input, perform calculations, and display output. Links to online code editors are provided for each task.

Uploaded by

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

Lab Report 3

This document summarizes Muhammad Saim Ashraf's Object Oriented Programming lab assignment. It discusses several tasks involving class scope and accessing class members in C++. The tasks include receiving errors when trying to access private data members from outside the class, making member functions private and using public access functions, creating a private constructor that cannot be called to create objects, and defining a subtraction class with private data members and public member functions to get input, perform calculations, and display output. Links to online code editors are provided for each task.

Uploaded by

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

OBJECT ORIENTED PROGRAMMING

Lab # 03 OOP

MUHAMMAD SAIM ASHRAF

Names

FA21-BEE-128
Registration
Numbers

Class 3A (BEE)

Instructor’s Name DR RIAZ HUSSAIN

Lab Assessment
Post Lab Total
Pre-Lab In-Lab
Data Presentation Data Analysis Writing Style
Lab 03 – Class Scope and Accessing
Class Members

5.1:- If I try to access the private data members in main()


function it gives me the following error.

Link: https://onlinegdb.com/fLSKZpSbt

5.2:- In this task I have modified the above task by making


the scope of public member functions as private, And Created
access functions in public scope to access private member
functions from main().
This goes like following and the program runs flawless

Link: https://onlinegdb.com/-T9Fs-WZA
5.3:- For this task I have made a program that includes a
private constructor in the class and I have Created an objects
of this class. But the constructor was unable to be called
because it was private in its class.

Link: https://onlinegdb.com/SStMN8Gk0

6.1:- In this I have created a class of subtraction having two


private data members. In this I will get 2 values from users
which will be subtracted. In this I have created 2 member
functions one will get values from user and the other will just
subtract those number and display it after this I have just
called them in main().

Link: https://onlinegdb.com/IHxvftt4m

You might also like