Welcome to ahex technologies

Object Oriented Programming

Object Oriented Programming
  • March 12, 2020
  • Venkat Adapala
  • 0

Object-Oriented Programming

Context:-   

The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function of the class.

So, we can build the real-time big applications by using the classes, methods, access specifiers, access modifiers, hiding data, showing data, extend the additional code with another class

OOP is a type of software design this design will useful for programming approach

And it is well suited for programs that are large, complex, actively updated and well-maintained projects.

How it works:-

A class that contains planning to to-do the work. And it doesn’t consume any space in memory of the machine

After you execute a class it will convert into the object and takes space in memory of the machine

The class structure is for code re-usability means the superclass is allowed to inherit the features of methods and variables of the superclass (parent class).

A feature of objects is an object’s procedures that can access and often modify the data fields of the object with which they are associated

Examples:-

A civil engineer gives a plan of design for building a house on a chart (CLASS). Then the workers will build the real house according to design (OBJECT).

Similarly, a programmer can give the class a logical structure text in a file (CLASS). Then after the system will run on execution and create data in memory according to login given (OBJECT).

Class:-

Class is a text which consists of the logical operations of the object.

And class can be extended with other classes using specific keywords

That class extension is useful for the project without affecting the entire core project.

And it also useful to debug the newly updated classes

The class consists mainly

  1. Variables
  2. Methods

The class architecture will like the variables can handle the data

Syntax:

  1. class<class_name>{
  2. variable;
  3. method;
  4. }

In all object-oriented programming languages fallowing the same structure of the class

  1. Classes
  2. Interfaces

Access Specifiers in class:-

Inside of the class, all are class variables

Inside of the method all are method variables

In programming, we can divide the variables and methods with access specifiers

  1. public
  2. private
  3. protected
  1. Public 
  2. Can access to other classes
  1. Private 
  2. Will hide the data in the current class itself.
  1. Protected 
  2. Will show data to the base class and derived-class only except all other classes it will hide

 

Method:

The main aim of the method is for writing a specific piece of code and returning its output

It’s always possible to build great things with certain blocks with a clear blueprint

Making everything is possible with clear objects

  1. The method is a part of the class. A class can be full filled with n number of methods
  2. A method can get the inputs through the parentheses and produces output when it gets called.
  3. A method is a set of code wizard

Example:-

In mathematics, we have the functions like f(x) = x*x same concept in programming implemented

Simpler a function in the program is a block of code performs a specific task and returns task output

Syntax:

  1. class<class_name>{
  2. function <method_name>(inputs){
  3. //task logic
  4. //return logic output
  5. }
  6. }

Object:

We use a specific keyword for converting class into the object.

After converting into the object all methods and variables will become the properties of the object

So, we could create the unique name of n number of objects with a different name

And also could interact with other objects with unique names

Conclusion:-

  1. This is about the main theme of object-oriented programming.
  2. For security purpose, access specifiers and access modifiers are implemented in object-oriented programming

And the architecture of object-oriented programming like the following.

  1. A class build with piece of code with certain methods, and variables
  2. All of those pieces of classes will build packages or modules.
  3. All of these modules or packages will build the entire project.