0
Q:

what is oop concept

OOP is a programming language model organized around
object rather than actions (logic and functions);
In other words, OOP mainly focuses on the objects that are
required to be manipulated instead of logic. This approach is
ideal for the programs large and complex codes and needs to
be actively updated or maintained.
- It makes development and maintenance easier
- It provides data hiding
- It provides ability to simulate real-world

OOP language follow 4 principles:
1-ENCAPSULATION: We can hide direct access to data by using
private key and we can access private data by using getter and
setter method.
2-ABSTRACTION: It is a process of hiding implementation details
and showing only functionality to the user. Abstraction lets
you focus on what the object does instead of how it does it.

3-INHERITANCE: It is used to define the relationship between two
classes. When a child class acquires all properties and
behaviors of parent class known as inheritance. Child class can
reuse all the codes written in parent class. It provides the code
reusability.

4-: POLYMORPHISM: It is an ability of object to behave in multiple
form. The most common use of polymorphism is Java, when a
parent class reference type of variable is used to refer to a child
class object.
E.g.: WebDriver driver = new ChromeDriver();
We use method overloading and overriding to achieve
Polymorphism.

0
class Person {
 void walk() {
  System.out.println(“Can Run….”);
 }
}
class Employee extends Person {
 void walk() {
  System.out.println(“Running Fast…”);
 }
 public static void main(String arg[]) {
  Person p = new Employee(); //upcasting
  p.walk();
 }
}
1
OOP is a programming language model organized around
object rather than actions (logic and functions);
In other words, OOP mainly focuses on the objects that are
required to be manipulated instead of logic. This approach is
ideal for the programs large and complex codes and needs to
be actively updated or maintained.
- It makes development and maintenance easier
- It provides data hiding
- It provides ability to simulate real-world

OOP language follow 4 principles:
1-ENCAPSULATION: We can hide direct access to data by using
private key and we can access private data by using getter and
setter method.
2-ABSTRACTION: It is a process of hiding implementation details
and showing only functionality to the user. Abstraction lets
you focus on what the object does instead of how it does it.

3-INHERITANCE: It is used to define the relationship between two
classes. When a child class acquires all properties and
behaviors of parent class known as inheritance. Child class can
reuse all the codes written in parent class. It provides the code
reusability.

4-: POLYMORPHISM: It is an ability of object to behave in multiple
form. The most common use of polymorphism is Java, when a
parent class reference type of variable is used to refer to a child
class object.
E.g.: WebDriver driver = new ChromeDriver();
We use method overloading and overriding to achieve
Polymorphism.
1
//	OOP is a programming paradigm found in many languages today.
//	Generally, an object is an instance of a Class.
//	Here's a Java example:
public class Car
{
	private double speed;
  	
  	public Car(double initialSpeed)	//	Constructor, most common way to initialize objects of a class.
    {
    	speed = initialSpeed;
    }
  
  	//	Accessor methods, aka getters
  	public double getSpeed()
    {
		return speed;
     	//	This is an example of encapsulation, where
      	//	methods are used to hide the implementation details
		//	and ensure the programmer can't modify things they shouldn't be able to.
    }
  
  	public void accelerate()
    {
		speed++;
    }
  
  	public void slowDown()
    {
    	speed--;
    }
}
0

New to Communities?

Join the community