0% found this document useful (0 votes)
30 views9 pages

OOP Concepts: Inheritance, Overloading, and More

This document discusses key concepts in object-oriented programming including inheritance, method overloading, method overriding, abstraction, encapsulation, member methods, constructor methods, static methods, and comparative methods. Inheritance allows a subclass to acquire properties from a superclass. Method overloading changes the number or type of arguments while method overriding redefines a method from a parent class. Abstraction hides unnecessary details and encapsulation hides implementation details by making data private. Member, constructor, and static methods are also explained.

Uploaded by

Shahab khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views9 pages

OOP Concepts: Inheritance, Overloading, and More

This document discusses key concepts in object-oriented programming including inheritance, method overloading, method overriding, abstraction, encapsulation, member methods, constructor methods, static methods, and comparative methods. Inheritance allows a subclass to acquire properties from a superclass. Method overloading changes the number or type of arguments while method overriding redefines a method from a parent class. Abstraction hides unnecessary details and encapsulation hides implementation details by making data private. Member, constructor, and static methods are also explained.

Uploaded by

Shahab khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Sunday, May 13, 2018

Advance Data Base Management System


BS (IT)_5-A Spring-2018

Assignment No #02 (Theory)

Student Name: NAJEEB ULLAH


Student Id: 02-235161-048
Registration No # 43868
Class Instructor: Sir. Tanveer Zahid

DEPARTMENT OF COMPUTER SCIENCE


BAHRIA UNIVERSITY, KARACHI
CAMPUS
Sunday, May 13, 2018

Inheritance:

In Object Oriented Programming (OOP) is the very basic and Important concept; Which means
the process when one class acquires the properties (methods and fields) of another. With the
use of inheritance, the information is made manageable in a hierarchical order.

The class which inherits the properties of other is known as subclass (derived class, child class)
and the class whose properties are inherited is known as superclass (base class, parent class).
Inheritance is also known as “Is-a” Relationship.
Sunday, May 13, 2018

Method Overloading:

When a Class (Type Object in Oracle) has multiple methods having same name but different in
parameters, it is known as Method Overloading. Methods overloading increases the readability
of the program. There are two ways to perform Method Overloading in OOP.

 By changing number of arguments


 By changing the data type
Sunday, May 13, 2018

Method Overriding:
Method Overriding is performed when a method defined in a Parent Class, and is re-defined by
one of its Chilled Class with same signature.
Sunday, May 13, 2018

Abstraction:
It is the process where we show only “relevant” data and “hide” unnecessary details of an
object from the user. It’s also called as Method Hiding.
Sunday, May 13, 2018

Encapsulation:

Encapsulation is the process to hide the implementation details from users. If a data member is
private, it means it can only be accessed within the same class. No outside class can access
private data member of other class.
Sunday, May 13, 2018

Member Methods:

A method is procedure or function that is part of the object type definition, and that can
operate on the attributes of the type. Such methods are also called member methods, and they
take the keyword MEMBER when you specify them as a component of the object type.

Constructor Methods:

Every object type has a constructor method, a function with the same name as the object type
that initializes and returns a new instance of that object type. Oracle generates a default
constructor for every object type, with formal parameters that match the order, names, and
datatypes of the object attributes. We can define your own constructor methods.
Sunday, May 13, 2018

Static Methods:

By declaring a member Procedure or Function as static, we make it independent of any


particular object of the class. A static member function can be called even if no objects of the
class exist and the static functions are accessed by using only the class name and the DOT
operator.

Comparative Methods:

Map Methods: Order Methods:


 It always be a Function not a  It always be a Function not a
Procedure. Procedure.
 It doesn’t have any Parameters.  It has two number of Parameters.
One is Hidden where as another is
 It returns any Scaler date type. defined.
 It executes at the most one time.  It returns only Numeric data type.
 It executes at multiple times when
 t executes by itself whenever objects ever objects are compared.
are compared.  t executes by itself whenever objects
 There can only be at the most on are compared.
order or Map function in a type.  There can only be at the most on
order or Map function in a type.
Sunday, May 13, 2018

Map Methods Ex: ORDER Methods Ex:

Common questions

Powered by AI

Inheritance allows a subclass to acquire properties and methods of a superclass, creating a hierarchy that organizes data. This relationship, known as an 'Is-a' relationship, makes data more manageable by grouping related classes together and allowing subclasses to be treated as instances of the superclass. This structure enables efficient code reuse and abstraction in complex systems .

Static methods differ from instance methods in that they belong to the class rather than any particular object instance. They can be called using the class name and DOT operator without needing to instantiate the class. This allows operations that do not depend on object-specific data, enhancing utility for general-purpose functions that are independent of instance context .

One might prefer order methods over map methods when multiple evaluations of object order are required because order methods recur multiple times during comparisons, providing a more thorough and nuanced comparison than the single execution of map methods. Additionally, order methods can manipulate parameters directly, offering flexibility in determining specific comparative logic .

Method overriding involves redefining a method from a superclass in a subclass with the same signature, enabling polymorphism by allowing a subclass to provide a specific implementation. Conversely, method overloading pertains to having multiple methods in the same class with the same name but different parameters, enhancing readability and flexibility while the signature varies. While overriding supports dynamic behavior changes, overloading allows diverse functionalities using uniform method names .

Encapsulation protects an object's data by restricting access to its internal state through private data members, which can only be accessed through public methods of the same class. This information hiding ensures the integrity of data, as it prevents external interference and misuse, thus promoting modularity and maintainability .

Abstraction plays a crucial role in OOP by exposing only relevant data while concealing unnecessary details, thus reducing complexity and increasing security. It permits focus on an object's high-level functionality, leading to fewer errors and better maintenance, as users interact through a simplified interface without delving into internal workings or changes .

Map methods in comparative operations are designed to aid object comparison by executing when objects are compared. They are always functions without parameters and return a scalar data type. Map methods execute a single time when comparisons occur, thereby facilitating comparisons by translating object data into a comparable scalar form .

Order methods are functions used for object comparison, essential for determining relational order between objects. Unlike map methods, order methods take two parameters (one hidden and one defined) and return a numeric data type. These methods execute multiple times during object comparisons, facilitating detailed evaluation of object order and hierarchy .

Constructor methods are vital in OOP as they initialize new object instances, setting initial values for attributes and establishing an object's state. Constructing every object with a defined state from the outset enhances reliability and reproducibility in execution, providing a controlled and predictable environment for object behavior .

Method overloading enhances program readability by allowing multiple methods with the same name but different parameters. This means different operations can be represented under a common method name, providing intuitive and logical grouping of operations. It helps programmers understand the function of the methods more clearly without needing access to detailed documentation .

You might also like