0% found this document useful (0 votes)
5 views2 pages

OBJECT ORIENTED PROGRAM

The document outlines the principles of Object-Oriented Programming (OOP), emphasizing the use of objects, classes, properties, and methods to solve problems. It details the process of class definition, object instantiation, and key concepts such as inheritance and encapsulation. Additionally, it describes various types of methods including mutator, accessor, auxiliary, constructor, and destructor.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

OBJECT ORIENTED PROGRAM

The document outlines the principles of Object-Oriented Programming (OOP), emphasizing the use of objects, classes, properties, and methods to solve problems. It details the process of class definition, object instantiation, and key concepts such as inheritance and encapsulation. Additionally, it describes various types of methods including mutator, accessor, auxiliary, constructor, and destructor.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

OBJECT ORIENTED PROGRAM

-uses objects (self-contained modules) to solve problems.


Objects
- An object is a module created by the programmer.
- An object represents something that can actually exist.
- Objects reacts to actions (events).
- Objects are grouped into classes.
- Objects have members called: properties and methods.
- A property describes the object while a method is something that can be done to an
object.
Object consist of:
-Property which is attributes or state
-Methods which are functions or procedures
1. Class Definition: Start by defining a class, which acts as a blueprint for creating
objects. A class encapsulates data and behaviors (methods) related to a specific entity
or concept. For example, you can create a class called "Person" to represent individuals
with properties like name, age, and methods like "introduce" or "updateAge."

2. Properties: Add properties to the class to store data relevant to the class. These
properties represent the state or characteristics of an object. For instance, in the
"Person" class, you can define properties like "Name: string" and "Age: Integer."

3. Methods: Implement methods within the class to define the behaviors of the objects.
These methods can perform specific actions or manipulate the properties of an object.
For example, in the "Person" class, you can have methods like "Introduce: procedure()"
that will display the person's name and age.
4. Constructors: Constructors are special methods used to initialize the object's
properties when an instance of the class is created. Delphi allows you to define
constructors for your classes, which are executed automatically when an object is
instantiated.

5. Inheritance: Utilize inheritance to create specialized classes based on an existing


base class. By inheriting from a base class, the derived class inherits its properties and
methods, allowing you to add more specific functionality or override inherited methods.
In Delphi, you can use the "Inherited" keyword to access the base class method while
overriding it in the derived class.

6. Encapsulation: Delphi supports encapsulation by specifying the visibility of


properties and methods using access specifiers like "private," "protected," and "public."
This allows you to control the accessibility of the class members and ensures better
code organization and security.

Object Instantiation: Finally, after defining your class, you can create instances of the
class known as objects. Instantiating an object allocates memory for the object and
allows you to work with its properties and methods.

TYPES OF METHODS
1. Mutator-set methods
-are used to change the properties of an object
-must be declared as public methods

2. Accessor –get function


-must be declared as public methods.
-t access the private variable and return that from the function
3. Auxiliary –define a function inside another function
-perform specific task without modifying the state of the object
4. Constructor-called when an object of a class is created.
-It can be used to set initial values for object attributes:
5. Destructor- is an instance member function that is invoked automatically whenever an
object is going to be destroyed
- is the last function that is going to be called before an object is destroyed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy