You are on page 1of 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