What are the OOPS concepts?
Answer Posted / manoj kumar verma
Object Oriented Programming (OOP) is used to build OOPs.
Object are the basic building block of Object Oriented
Programming System (oops).The real world objects have two
characteristics: state and behavior.
OOPs consist of the following features:
1. Encapsulation
2. Abstraction
3. Inheritance
4. Polymorphism
Encapsulation: Encapsulation is the process of hiding of the
details of an object that do not contribute to its essential
characteristics.
Means, hiding of the data members or packing of data members
and methods inside a single unit. i.e. class
For example:
Class A
{
int x,y,z; // member data
teach(); // member method
A manoj; object
}
Where “A” is the class name and manoj is the object of class.
Abstraction: Only show the essential details and do not show
the non essential details. i.e. concentrate an
essential/compulsory any parts.
Like tv, buttens like on/off switch, color, volume channel
are shows but reset parts are encapsulated.
Inheritance: Inheritance enables you to extend the
functionality of an existing class. You create a class that
inherits the attributes and behavior of another class. The
new class can consist of a few new attributes and behaviors
that are specific to the class.
“Reusability of the code by making derived class from the
base class.
i.e.
father -> child.
More properties/features are with child class.
A class is made looking at which the new derived class id
made with modifications or additions in the derived class.
Polymorphism: when one object shows various forms then it is
known as polymorphism.
Poly -> many
Morphism ->form
Many forms of an object.
For i.e. with one mobile button you can do various actions
at different times.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is oop better than procedural?
What are the three main types of variables?
why reinterpret cast is considered dangerous?
Get me an image implementation program.
Is html an oop?
How to improve object oriented design skills?
Why do we use polymorphism?
What is a superclass in oop?
Where You Can Use Interface in your Project
How is class defined?
What are the 3 principles of oop?
Write a c++ program to display pass and fail for three student using static member function
What is class and example?
Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation
Why do we need oop?