Oops is an acronym of Object Oriented Programmings.To understand oops,you
must know about objects and all other concepts of oops, which is described
below.
The major concepts of oops are:
- Objects and
classes
- Data abstraction
- Data encapsulation
- Inheritance
- Polymorphism
- Methods and
message passing
- Overloading
- Reusability
Objects:
- Object is
generally defined as real time entity or run time entity.
- An object may be a
name of a person,or a place,or any other things.
- Eg: Arthi, India,
2245601, etc..,
- Syntax: class_name
object name;
- Eg: sample s; where
"sample" is the name of the class and s is our object.
Classes:
- Class is defined as an entity
which data and functions together.
- It is similar to the concept
of STRUCTURE in c language.
- Syntax:
class name_of_class
{
private:
variable decln;
function decln;
protected:
variable decln;
function decln;
public:
variable decln;
function decln;
};
- Example:
class sample
{
private:
int a;
public:
void welcome()
{
cout<<"welcome";
}
};
The variables inside the class are called as data members whereas the functions inside the class is called as member functions
No comments:
Post a Comment