Programming: Object Oriented Programming: Object-Oriented Programming (OOP) Is A

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

★★FSK ---৩৫/৩৬

★★Divide & conquer,Dynamic programming ---৩৫/৩৭

★★Software validation & verification -----৩৫/৩৬

★★Cocomo model---৩৫/৩৬/৩৭

★★Deadlock handling এর জন্য Bankers algorithm ---৩৫/৩৭

★★Primary & foreign key---৩৬/৩৭

★★Big 0,Big omega,Big theta ---৩৫/৩৭

★★Expert system উদাহরনসহ---৩৫/৩৬

★★Np hard,Np complete---৩৫/৩৬/৩৭

★★SQL কী?উদাহরন ----৩৫/৩৭

★★TDM---৩৫/৩৭

★★Digital signature, public key & private key eencryption কীভাবে কাজ করে---৩৫/৩৬/৩৭

★★Database normalization কি? 1NF,2NF,3NF,BCNF কেন প্রয়োগ করা হয়---৩৫/৩৬/৩৭

★★পার্থক্য ঃPaging & Segmentation---৩৫/৩৭

Programming

Object Oriented Programming: Object-oriented programming (OOP) is a


programming paradigm based on the concept of "objects", which may contain data,
in the form of fields, often known as attributes; and code, in the form of procedures,
often known as methods.

OOP Principles: There are total four OOP principles which are given below.
1. Encapsulation: Encapsulation is the mechanism that binds together code and the
data it manipulates, and keeps both safe from outside interference and misuse. In
encapsulation, the variables of a class will be hidden from other classes, and can be
accessed only through the methods of their current class. Therefore, it is also known
as data hiding.

2. Inheritance: Inheritance is the process where one object acquires the properties
(methods and fields) of another objects. With the use of inheritance the information is
made manageable in a hierarchical order. The class which inherits the properties of
other class is known as subclass (derived class, child class) and the class whose
properties are inherited is known as superclass (base class, parent class).

3. Polymorphism: Polymorphism is a feature that allows one interface to be used for a


general class of actions. In other words, Polymorphism is the ability of an object to
take on many forms. The most common use of polymorphism in OOP occurs when a
parent class reference is used to refer to a child class object.

4. Abstraction: Abstraction is a process of hiding the implementation details from the


user, only the functionality will be provided to the user. In other words, the user will
have the information on what the object does instead of how it does it.

Constructor: A constructor initializes an object immediately upon creation. It has the same
name as the class in which it resides and is syntactically similar to a method. Once defined,
the constructor is automatically called when the object is created, before the new operator
completes. Constructors look a little strange because they have no return type, not even
void. This is because the implicit return type of a class constructor is the class type itself.

Default Constructor: A default constructor is a constructor that either has no parameters, or


if it has parameters, all the parameters has default values. If there is no constructor defined
in a class, compiler automatically defines a default constructor.

Copy Constructor: The copy constructor is a constructor which creates an object by initializing it
with an object of the same class, which has been created previously. The copy constructor is used to −
● Initialize one object from another of the same type.
● Copy an object to pass it as an argument to a function.
● Copy an object to return it from a function.
If a copy constructor is not defined in a class, the compiler itself defines one. The most common form
of copy constructor is shown here −
Destructor: Destructors are the concept of object oriented programming. Constructors are
called when the object is created, and the destructor is called when the object is erased. A
object is by the way like a clone of a class. That way there can be several objects or
instances of a class. In Java, programmers don’t need to worry about destructors. There is
no syntax for destructors in java. Objects are destructed but there is no destructor. The Java
Virtual Machine handles that for you. In other languages like c++ or c# you can also write a
destructor but not in java. In C++ you write a destructor like a constructor but with a ~ before
the name.

Abstract Class: An abstract class is a class that contains one or more abstract methods. An
abstract method is a method that is declared, but contains no implementation. Abstract
classes may not be instantiated, and require subclasses to provide implementations for the
abstract methods. An abstract method of a superclass must be implemented by the
subclass.
Multithreaded Programming: A multithreaded program contains two or more parts that can
run concurrently. Each part of such a program is called a thread, and each thread defines a
separate path of execution. Thus, multithreading is a specialized form of multitasking.

Thread Example:
● By extending Thread Class:

● By implementing Runnable Interface:


Method Overloading: Method Overloading is a feature that allows a class to have more
than one method having the same name, if their argument lists are different.

Method Overriding: Overriding is a feature that allows a subclass or child class to provide a
specific implementation of a method that is already provided by one of its superclasses or
parent classes.

Access Modifiers: Access modifiers (or access specifiers) are keywords in object-oriented
languages that set the accessibility of classes, methods, and other members.
There are total four types of access modifiers.

1. Default: A variable or method declared without any access modifier is considered as


default access modifier and available to any other class in the same package. Default
access modifier means we do not explicitly declare an access modifier for a class,
field, method, etc.
2. Public: When a member of a class is modified by public, then that member can be
accessed by any other code.
3. Private: When a member of a class is specified as private, then that member can
only be accessed by other members of its class.
4. Protected: Variables, methods, and constructors, which are declared protected in a
superclass can be accessed only by the subclasses in other package or any class
within the package of the protected members' class. The protected access modifier
cannot be applied to class and interfaces.

Friend Function: A friend function of a class is defined outside of that class scope but it has
the right to access all the private and protected members of the class. Even though the
prototypes for friend functions appear in the class definition, friends are not member
functions.
A friend can be a function, function template, or member function, or a class or class
template, in which case the entire class and all of its members are friends.
Recursion: Recursion is the process of repeating items in a self-similar way. In
programming languages, if a program allows you to call a function inside the same function,
then it is called a recursive call of the function.

You might also like