SlideShare a Scribd company logo
Concept of
Class & Object
Lecture 5
Asif Shahzad
What is a Class
• Primitive types are not enough to represent real life
objects. It would require more code and make the
software maintenance difficult.
• We need composite types, called classes.
• One variable of a class (called object), can store multiple
values/attributes. It becomes easy to create, pass and
process real objects’ data. *
• Class is a blueprint, from which objects are created.
Person Example
• Write code
• Assume: id, name and age attributes
• Create object of Person and use it …
Ref: zameen.com Ref: ilaan.com
Lec05   class and object
int a = 10;
int b = 20;
Person p1 = new Person();
Person p2 = new Person();
Real life objects also have behavior

More Related Content

PDF
12. Objects I
PDF
Rubyandrails
PPT
Java- Java tech overview- Mazenet solution
PPTX
Cascading Style Sheets CSS
PPTX
Lec03 print on console and getting input
PPTX
Lec02 primitive types
PPTX
Lec01 intro and hello world program
PPTX
Lec08 constructors
12. Objects I
Rubyandrails
Java- Java tech overview- Mazenet solution
Cascading Style Sheets CSS
Lec03 print on console and getting input
Lec02 primitive types
Lec01 intro and hello world program
Lec08 constructors

Recently uploaded (20)

PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
Cost to Outsource Software Development in 2025
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Types of Token_ From Utility to Security.pdf
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
assetexplorer- product-overview - presentation
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
Microsoft Office 365 Crack Download Free
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
Time Tracking Features That Teams and Organizations Actually Need
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
CCleaner 6.39.11548 Crack 2025 License Key
Weekly report ppt - harsh dattuprasad patel.pptx
"Secure File Sharing Solutions on AWS".pptx
Cost to Outsource Software Development in 2025
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Topaz Photo AI Crack New Download (Latest 2025)
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Autodesk AutoCAD Crack Free Download 2025
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Types of Token_ From Utility to Security.pdf
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
assetexplorer- product-overview - presentation
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Microsoft Office 365 Crack Download Free
Designing Intelligence for the Shop Floor.pdf
Trending Python Topics for Data Visualization in 2025
Visual explanation of Dijkstra's Algorithm using Python
Time Tracking Features That Teams and Organizations Actually Need
Why Generative AI is the Future of Content, Code & Creativity?
CCleaner 6.39.11548 Crack 2025 License Key
Ad
Ad

Lec05 class and object

  • 1. Concept of Class & Object Lecture 5 Asif Shahzad
  • 2. What is a Class • Primitive types are not enough to represent real life objects. It would require more code and make the software maintenance difficult. • We need composite types, called classes. • One variable of a class (called object), can store multiple values/attributes. It becomes easy to create, pass and process real objects’ data. * • Class is a blueprint, from which objects are created.
  • 3. Person Example • Write code • Assume: id, name and age attributes • Create object of Person and use it …
  • 6. int a = 10; int b = 20; Person p1 = new Person(); Person p2 = new Person();
  • 7. Real life objects also have behavior