0% found this document useful (0 votes)
37 views4 pages

Oop Definitions

The document discusses object-oriented programming concepts including objects, classes, data members, member functions, access specifiers, constructors, destructor, static data members, and operator overloading. An object contains data and functions, and a class defines common properties and functions for a collection of objects. Constructors initialize objects, destructors destroy objects, and access specifiers control data access. Operator overloading allows operators to process user-defined data types.

Uploaded by

Freedom Fighter
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)
37 views4 pages

Oop Definitions

The document discusses object-oriented programming concepts including objects, classes, data members, member functions, access specifiers, constructors, destructor, static data members, and operator overloading. An object contains data and functions, and a class defines common properties and functions for a collection of objects. Constructors initialize objects, destructors destroy objects, and access specifiers control data access. Operator overloading allows operators to process user-defined data types.

Uploaded by

Freedom Fighter
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/ 4

 OOP:

Object-Oriented programming is a programming technique in which


programs are written on the basis of objects.
OOP is a powerful technique to develop software. It is used to
analyze and design the applications in terms of objects. It deals with
the data and the procedures that process the data as a single objects.
 Objects:
An object is collection of data and functions. An object may repreent
a person, place or thing in real world.
 Class:
A collection of objects with same properties and functions is known
as class. It is used to define the characterstics of the objects.
Each object of a class is known as an instance of its class.
 Syntax of class:
Class identifier/name
{
Body
};
 Data members:
The variables declared in a class are known as data members.
 Member Functions:
The functions declared in a class are known as member functions.
 Access Specifiers:
The commands that used to specify the access level of class members
are known as access specifiers.
1. ‘private’ Access specifier:
A private access specifier is used to restrict the use of class
member within the class. It is also default access specifier.
2. ‘public’ Access specifier:
A public access specifier is used to allow the user to access a
class member within the class as well as outside the class.
Public member of class can be accessed from anywhere in the
program.
 Syntax of Object:
Class-name object-name;
 Executing Member functions:
 Syntax:
Object-name.function();
 Constructors:
A type of member function that is automatically executed when an
object of that class is created is known as constructor.
It is normally defined in the class to initialize data member.
 Syntax:
Class-name()
{
Constructor Body
}
 Types of constructors:
1- Default constructor:
2-No argument constructor:
3-Parameterize constructor:

 Constructor Overloading:
The process of declaring multiple constructors with the same name
but different parameters is known as constructor overloading. The
constructor with same name must differ in one of the following
ways:
 Number of parameters
 Type of parameters
 Sequence of parameters
 Default copy constructor:
A type of constructor that is used to initialize an object with another
object of the same type is known as Default copy constructor.
 Syntax
Class-name object-name(parameter);
Or
Class-name object-name=parameter;
 Destructors:
A type of member function that is automatically executed when an object
of that class is destroyed is known as destructors.
 Syntax:
~class-name()
{
Destructor body
}
 Static data member:
A type of data member that is shared among all object of class is known as
static data member. It is define in class with static keyword.

 Difference b/w structure and classes


OPERATOR OVERLOADING
 Operator overloading:
The process of defining additional meanings of operator is known as
operator overloading.
It enables an operator to perform different operations depending on the
type of operands. Also enables the operators to process the user-defined
data types.
 Syntax:
return-type operator op()
{
Function body’
}
 Example:
Void operator ++()
{
Function body;
}
 Overloading unary operator:
A type of operator that work with single operand is called unary operator.
They are overloaded to increase their capabilities.
 Overloading Binary Operator:
A type of operator that work with two operands is called binary operator.
They are overloaded to increase their capabilities.

Prepared by: Raja Waqas


BS(IT) 1822

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