Sei sulla pagina 1di 3

OOPS: Object Oriented Programming Structure

OOPS have four pillars


1) Polymorphism
2) Inheritance
3) Encapsulation
4) Abstraction

Difference between Object oriented language and object based langauge?

Object oriented have all 4 pillars while Object based have only 3 pillars.
Inheritance is not present in Object based Language.

Difference between Object oriented and Procedural Oriented


1) POP work on procedure or structure
while OOPS work on Data.
2) POP used function which takes more memory
while OOPS used object take less memory.
3) POP does not security
while OOPS provide security
4) C is based on POP while C++, java and so on based on OOPS

Java is very much secure:


1) Java doesnot have explicit pointers.
2) java has a classloader
3) java has a bytecode verifier
4) All java program run in a virtual machine sandbox i.e.JVM

Encapsulation: wrapping of data and method into a single class.


Encapsulation used private keyword that hide the data from outside class.

Out of Abstraction and encapsulation which one is called data hinding?

data hiding: the complete hiding of data from the outside class. It is used private
keyword

Ans Encapsulation is called data hiding.

Abstraction: the act of representing the essential details and hiding the
background details.

friend function:

it a function which access the data and methods of private variable outside the
class.

java use getter and setter method.


getter and setter access the functionality but not variable of any private data

Modifier:

1) access modifier
a) private--- with in the class but ouside the class
b) protected--- with in the classes and subclasses(parent and child)
c) public--- anywhere in the package,subpackage and outside the package
d) default----- packages and subpackages
2) Non access modifier
1) static
2) final
3) abstract

class used only these three non access modifier.

polymorphism:

one thing many form.

it can be achieved by two ways:


1) method overloading--- compile time polymorphism---- static binding--- early
binding

Same method Name but different parameter in the same class.

1) formal parameter-- the argument pass at method defination


2) actual parameter-- the value pass at method calling

Binding: connect a method call to method body.


1) Static Binding: when the object is known at compile time
2) Dynamic Binding: when the Object is known at rum time

Method Overloading can be achieved by two ways


1) By changing the number of parameter
2) by changing the data type

Method Overriding-- runtime polymorphism--- dynamic binding--- late binding.

Method Overriding: same method name and same parameter in different class that
follow IS-A relationship(Inheritance)
HAS-A(aggreation)

Type casting--- type conversion--- type coehsion--- boxing


1) Implicit-- autoboxing--- primitive and reference
2) explicit--- unboxing---- primitive and reference

Potrebbero piacerti anche