OOPs concept of C++ programming

C++ OOPs concept

Hello! In the previous blog we learned some basic terminology of C++, but in this blog we are going to learn the object orientation concept of C++ for which this language is famous.so let’s get started.

The major purpose of C++ programming is to introduce the concept of object orientation to the C programming language.

OOPs is a paradigm that provides us many concepts such as inheritance, data binding, polymorphism etc.


SMART ENGINEERS

Object -orientation

Object orientation is basically a thinking methodology which describe following points.

1.Everything is an object.

2.Any system is composed of object (a system is also an object).

3.The evolution and development of a system is caused by the interactions of the objects inside/outside a system.

Everything is an object

Any entity that has state and behaviour is known as object.

   1.A student, a professor

   2.A desk, a chair, a classroom, a building

   3.A university, a city, a country

   4.The world, the universe

   5.A subject such as CS, IS, math, history

The evolution and development of a system is caused by the interactions

We will understand interaction between object by an example of an university.

1.Students

2.Professors

3.Staff

4.Board governance

5.State governance

Here students, professors, staff are that object that are doing interactions inside university. And board governance, state governance are objects that are doing interactions outside university.

Reading and writing of data

You might have thinking that how we can read and write data in C++, so answer of that question is that we use two operators for this work.

1.Two operators are introduced in C++ i.e. cout and cin

2. cout is a predefined object and represents the standard output stream and this output stream represents the screen. Cout, requires iostream file.

E.g. cout<<” Indian”;

3. cout will display this string as such on screen.

4.<< is called insertion operator or put to operator.

5.It is also called bit-wise left -shift operator.

6.If string is Variable then cout can be used to display the contents of strings.

For Example:-

cout<< string;

7. cin operator is used to read the data.

cin>>a;

8.>> is called extraction operator.

The cout Object

These are following points about cout object.

1.It can be used to send more than one item to cout.

cout<< “hello “ <<” there!”;

Or

cout<<” hello”;

cout<<”there!”;

2.This produces one line of output.

The cin Object

1.Standard Input Object

2.Like cout, requires iostream file

3.Used to read input from keyboard

4.Information retrieved from cin with >>

5.Input is stored in one or more variables

6. cin converts data to the type that matches the variable:

Int height;

cout<<”how tall is this room?”;

cin>>height;

7.It can be used to more than one value:

cin>>height>>width;

8.Multiple values from keyboard must be separated by spaces

9.Order is important: first value entered goes  to first variable, etc.


In the next blog we will learn about classes and object in C++, I hope this blog help you in understanding  the concept of object orientation in c++. 

read more about my previous blog regarding basic introduction of  c++ click here......

 


Comments

Post a Comment

Popular posts from this blog

Decision making with if statement and else..if

Switch statement in C language

Call by value and by reference in function