What do you mean by object-oriented thinking ?
Object oriented thinking involves writing of classes, which represents objects in problem domains.
For example,
Writing a program for student management, than we can create object studentm fee reciept, attendance, etc.
What is Object Oriented Programming ?
The programming which involves use of classes and objects.
Some examples of object oriented programmins are:
- C++
- Java
- Python
- C#, etc.
What is procedural programming language ?
programming language that describes a sequence of well-organized actions and processes.
Some examples of procedureal programming language:
- C programming
- Cobol
- Algol
- Fortran
Features of object oriented programming ?
- Inheritance
- Encapsulation
- Abstraction
- Polymorphism
- Method Overriding
- Method Overloading
- Objects
- Classes
- Constructors and Destructors
Merits and demerits of object oriented methodology ?
Merits of object oriented methodology
- Reuse of code using class
- Easy to maintain
Demerits of object oriented methodology
- Complex to create programs
What is encapsulation ?
Encapsulation is defined as the wrapping up of data under a single unit.
How to implement encapsulation in C++ ?
class Rectangle {
public:
int length;
int breadth;
int getArea() {
return length * breadth;
}
};
Class binds variables and methods.
What is data abstraction ?
Providing only essential information about the data to the outside world, hiding the background details or implementation.
How to implement data abstraction in C++ ?
Create a method, and call it when required. Without rewriting code.
#include <iostream>
class implementAbstraction
{
private:
int a=100;
public:
void show()
{
cout<<"a = " <<a << endl;
}
};
int main()
{
implementAbstraction obj;
obj.show();
return 0;
}