Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

OBJECT ORIENTED PROGRAMMING

Lab # 06 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 06 – Static Class Data and Static
Member Function

Task 4.1 Example


In this task we are just learning about static data
members and static member function
A public static data member can be access using any
object of the class or class name
A private static member can be access using a public
member function
Static function can only access static data member of
class and main benefit of this is that we can call static
member function by just name of class we don’t need
objects to call it.
LINK:
https://onlinegdb.com/mkeHfVzph

Lab Task 5.1


In this task we have to use static data members and
static member function to calculate the annual interest
of two user by 3% and 4% interest rate and at the
display the amount of user after certain time for this I
used a monthly interest rate calculator by following
method
savingsBalance += ((savingsBalance *
annualInterestRate) / 12)
LINK:
https://onlinegdb.com/2FmUczX-h
Home Task 6.1
In this task I have to write a program to count the
number of objects created and destroyed for a class
using static data members and static member functions
for this I made a state data member ‘count’ which can
only be called by static data member function so I
created a static function ‘ID CALL’ which increments its
value
LINK:
https://onlinegdb.com/BZVVQCpok

You might also like