OBJECT ORIENTED PROGRAMMING
Q1. What is Object Oriented Programming?
Ans:-
a) Object Oriented Programming decomposes a program into real world entities called as objects and then creates data and function around these objects.
b) Object Oriented Programming is based on 4 major pillars which are as follows:
a) Object Oriented Programming decomposes a program into real world entities called as objects and then creates data and function around these objects.
b) Object Oriented Programming is based on 4 major pillars which are as follows:
i. Data Abstraction:-
This deals with identifying the key aspects of a system. This is normally required during requirement analysis phase.
ii.ata Encapsulation:-
The key aspects identified during abstraction are secured using encapsulation. This deals with hiding the interface from implementation. Hence its purpose is security.
iii. Inheritance:-
This deals with incorporating the essential features from a base class in a derived class. Thus it helps in reusability of methods and its main purpose is for grouping.
iv. polymorphism:
C++ Program Structure:
C++ Program Structure:
Let us look at a simple code that would print the words Hello World.
#include <iostream>
using namespace std;
// main() is where program execution begins.
int main()
{
cout << "Hello World"; // prints Hello World
return 0;
}
No comments:
Post a Comment