Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

1.3: OOP Objects

( \newcommand{\kernel}{\mathrm{null}\,}\)

An Object is an identifiable entity with some characteristics and behavior. An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated.

class person 
{ 
   char name[20]; 
   int id; 
   public: 
      void getdetails(){} 
};

int main() 
{ 
   person p1; // p1 is a object 
} 

Object take up space in memory and have an associated address just like any other date type in C++.

When a program is executed the objects interact by sending messages to one another.

Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code, it is sufficient to know the type of message accepted and type of response returned by the objects.

Adapted from
"Object Oriented Programming in C++" by Vankayala Karunakar., Geeks for Geeks is licensed under CC BY 4.0


This page titled 1.3: OOP Objects is shared under a CC BY-SA license and was authored, remixed, and/or curated by Patrick McClanahan.

Support Center

How can we help?