324x Filetype PDF File size 0.16 MB Source: cse.iitkgp.ac.in
Module 11
Sourangshu
Bhattacharya Module 11: Programming in C++
Objectives & Classes and Objects
Outline
Classes
Objects
Data Members Sourangshu Bhattacharya
Complex
Rectangle
Stack Department of Computer Science and Engineering
Member Indian Institute of Technology, Kharagpur
Functions
Complex sourangshu@cse.iitkgp.ac.in
Rectangle
Stack
this pointer Slides taken from NPTEL course on Programming in C++
State of an by Prof. Partha Pratim Das
Object
Complex
Rectangle
Stack
Software Engineering 2022 Sourangshu Bhattacharya 1
Summary
Module Objectives
Module 11
Sourangshu Understand the concept of classes and objects in C++
Bhattacharya
Objectives &
Outline
Classes
Objects
Data Members
Complex
Rectangle
Stack
Member
Functions
Complex
Rectangle
Stack
this pointer
State of an
Object
Complex
Rectangle
Stack
Software Engineering 2022 Sourangshu Bhattacharya 2
Summary
Module Outline
Module 11
Sourangshu Classes
Bhattacharya Objects
Objectives & Data Members of a class
Outline
Classes Member functions of a class
Objects this Pointer
Data Members
Complex State of an Object
Rectangle
Stack
Member
Functions
Complex
Rectangle
Stack
this pointer
State of an
Object
Complex
Rectangle
Stack
Software Engineering 2022 Sourangshu Bhattacharya 3
Summary
Classes
Module 11 Aclass is an implementation of a type. It is the only way to
implement User-defined Data Type (UDT)
Sourangshu
Bhattacharya Aclass contains data members / attributes
Objectives & Aclass has operations / member functions / methods
Outline
Classes Aclass defines a namespace
Objects Thus, classes offer data abstraction / encapsulation of
Data Members Object Oriented Programming
Complex
Rectangle
Stack Classes are similar to structures that aggregate data logically
Member Aclass is defined by class keyword
Functions
Complex
Rectangle Classes provide access specifiers for members to enforce data
Stack hiding that separates implementation from interface
this pointer
State of an private — accessible inside the definition of the class
Object public — accessible everywhere
Complex
Rectangle Aclass is a blue print for its instances (objects)
Stack
Software Engineering 2022 Sourangshu Bhattacharya 4
Summary
no reviews yet
Please Login to review.