0% found this document useful (0 votes)
2 views

Object Oriented Programming Techniques (CLASSES)

The document discusses Object Oriented Programming techniques, focusing on the importance of classes as user-defined prototypes for creating objects. It outlines the components of objects, including state, behavior, and identity, and provides examples of member variables and functions. Additionally, it introduces the concept of constant member variables that cannot be modified after initialization.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Object Oriented Programming Techniques (CLASSES)

The document discusses Object Oriented Programming techniques, focusing on the importance of classes as user-defined prototypes for creating objects. It outlines the components of objects, including state, behavior, and identity, and provides examples of member variables and functions. Additionally, it introduces the concept of constant member variables that cannot be modified after initialization.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Object Oriented

Programming Techniques
Revision
• Why Classes?
• User defined prototype through which objects are created
• Represents set of properties similar to all objects of one type
• Objects: Represents entities
• Objects consists of:
• State: attributes of an object
• Behavior: method of an object
• Identity: unique name which can interact with other objects
• Memory is utilized for objects
• Objects are accessed through member access operator
Member Variables
Revision float width;
float length;
float area;

Member Functions
void setData(float w, float l)
{ … function code … }
void calcArea(void)
{ … function code … }
void getWidth(void)
{ … function code … }
void getLength(void)
{ … function code … }
void getArea(void)
{ … function code … }
Revision (Write code for class
Dog)
Example

Output
Dry run example code
Constant Member Variable
• Data member used with const keyword
• Cannot be modified after initialization
Constant Member
Variable Example

Output

You might also like