GoConqr has a new look! Let us know what you think.

Notes

OOPs

Saurabh Prasad English 1 page

Content of the notes (1)

Page 1

Object oriented programming

1. Concepts: Class, objects, inheritance, polymorphism, encapsulation abstraction - learning these concepts by using human anatomy

Class: Human being is a class. Class also called as type could be defined as design where everything is defined. Human being as a class has properties like eyes, hand etc and functions like walk (), talk(), see() etc.

Inheritance: Male and Female are also class. Most of properties & functions for male and female are already defined under Human Being class. So they (male & female class) can use inheritance to use these properties and functions from human being class. You don't need to redefine properties and functions already defined under human beings again for male and female classes.

Object: Object is instance of a class which has physical existence. Example- My name is Saurabh and I am an object of class male. You should think of class as a logical definition

Abstraction: Hiding the details from outside world or showing only what's required. Human beings can talk, hear , eat but how its done is hidden from the outside world. Skin could be the abstraction factor which hides mechanism of these functions from outside world.

Encapsulation: This refers to binding properties with functions. This binds properties (eyes, legs, hands) to respective functions (see, walking, holding)

Note: You can define private variables within a class which cannot be accessed outside the class. Now, in order to access these private variables, variable public functions need to be defined within the class. This is called data hiding so encapsulation also leads to data hiding.

Polymorphism:It allows to define more than one way to do something. This could be done by changing the process (overriding)or changing the parts (overloading) of it . If you define, walking is done by hand instead of walking on legs then it is called as overriding. if you are walking in a straight line (normally) and then suddenly you change it to walking backwards then its called overloading..

Information

Description
Note on OOPs, created by Saurabh Prasad on 15/06/2020.
Created by
Saurabh Prasad
Views
2
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?