Advertisement

Object in Computer Programming

Object in Computer Programming

In object-oriented programming, an object is a self-contained entity that consists of both data and behavior. Objects are created from templates called classes, which define the characteristics and behaviors that objects of that class will have. Objects can interact with each other through methods, which are functions that are associated with a specific object or class.


For example, in a program that models a bank account, you might have a class called "Account" that has properties like the account balance and account holder name, and methods like "deposit" and "withdraw" that allow you to modify the account balance. Each individual bank account would be an object, with its own unique balance and owner, that you can manipulate using the methods defined in the Account class.


a girl writing a program in a computer


Function of Object

An object can perform different tasks and actions. Those actions which are performed by an object are known as functions or methods. For example, the object car performs the following functions

  1. Start
  2. Stop
  3. Accelerate
  4. Reverse

Post a Comment

0 Comments