OBJECT ORIENTED PROGRAMMING
Lab # 04 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 04 – Objects and
Methods
5.1:- In this first task we were given an example of complex
class and this program can do addition and we were asked to
also add member of multiplication and subtraction so I just did
some changing in addition function and made two other
member function for subtraction and multiplication and
introduce some other attributes in main to contain that
information
Link: https://onlinegdb.com/2_LjxMMSd3
5.2:- So this time I was given the same program and asked
to just remove the show function from class and define it
outside the class and also as inline function, An inline function
is one for which the compiler copies the code from the
function definition directly into the code of the calling function
rather than creating a separate set of instructions in memory.
Link: https://onlinegdb.com/DYlFFVpNO
5.3:- In this task I just have to remove the definition of
member function which I added in the class before and
defined It outside the class but I have to declared it inside the
class and make it public so I can access it outside the class and
then just by making another file and linking it with class and
giving its return type I was able to define member function
outside the class and called it in main.
Link: https://onlinegdb.com/U2xjPg8Nd
5.4:- In this I was just given the the example above named
distance and I just have to test it but I managed to sort it out
and make files of it.
Link: https://onlinegdb.com/52o90NPkGh
6.1:- This task was very easy just like in task 5.1 I was just
asked to add additional member function of subtraction and
multiplication and I just followed the steps I mentioned in task
5.1
Link: https://onlinegdb.com/UEI-yCSdR