Sponsored Links
C++ Tutorials
- C++ Dereference Operator
- C++ Memory Management operators
- C++ Void Pointer and Null Pointer
- C++ Pointers
- C++ Static Functions
- C++ Friend Functions
- C++ Pure Virtual Function and Base Class
- C++ Virtual Functions
- C++ Polymorphism
- C++ Encapsulation
- C++ Abstraction
- Static Functions - An Introduction
- C++ Inheritance
- Scope of Variables in Function
- C++ Inline Functions
- C++ Function Passing Types
- C++ Storage Classes
- Concept of Function with Arguments
- Concepts of Function
- C++ Operator Overloading Part II
Tutorials
C++Basic concepts of OOPS and Structure of C++ program
Basic concepts of OOPS and Structure of C++ program
In this tutorial you will learn about Objects, Classes, Inheritance, Data Abstraction, Data Encapsulation, Polymorphism, Overloading, Reusability.
Before starting to learn C++ it is essential that one must have a basic knowledge of the concepts of Object oriented programming. Some of the important object oriented features are namely:
- Objects
- Classes
- Inheritance
- Data Abstraction
- Data Encapsulation
- Polymorphism
- Overloading
- Reusability
In order to understand the basic concepts in C++, the programmer must have a command of the basic terminology in object-oriented programming. Below is a brief outline of the concepts of Object-oriented programming languages:
Objects:
Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.

An Object is a collection of data members and associated member functions also known as methods.
Classes:
Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class. Thus a Class represent a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects becomes functions of the class and is referred to as Methods.
For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Colour, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.
No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created.
Inheritance:
Inheritance is the process of forming a new class from an existing class or base class. The base class is also known as parent class or super class, The new class that is formed is called derived class. Derived class is also known as a child class or sub class. Inheritance helps in reducing the overall code size of the program, which is an important concept in object-oriented programming.
Data Abstraction:
Data Abstraction increases the power of programming language by creating user defined data types. Data Abstraction also represents the needed information in the program without presenting the details.
Data Encapsulation:
Data Encapsulation combines data and functions into a single unit called Class. When using Data Encapsulation, data is not accessed directly; it is only accessible through the functions present inside the class. Data Encapsulation enables the important concept of data hiding possible.
Polymorphism:
Polymorphism allows routines to use variables of different types at different times. An operator or function can be given different meanings or functions. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
Overloading:
Overloading is one type of Polymorphism. It allows an object to have different meanings, depending on its context. When an exiting operator or function begins to operate on new data type, or class, it is understood to be overloaded.
Reusability:
This term refers to the ability for multiple programmers to use the same written and debugged existing class of data. This is a time saving device and adds code efficiency to the language. Additionally, the programmer can incorporate new features to the existing class, further developing the application and allowing users to achieve increased performance. This time saving feature optimizes code, helps in gaining secured applications and facilitates easier maintenance on the application.
The implementation of each of the above object-oriented programming features for C++ will be highlighted in later sections.
A sample program to understand the basic structure of C++
|
//program to read employee details and to output the data public: void displayvalue() main() |
Overview of the Basic Structure of C++ Programming
- The // in first line is used for representing comment in the program.
. - The second line of the program has a # symbol which represents the preprocessor directive followed by header file to be included placed between < >.
. - The next structure present in the program is the class definition. This starts with the keyword class followed by class name employee. Within the class are data and functions. The data defined in the class are generally private and functions are public. These explanations we will be detailed in later sections. The class declaration ends with a semicolon.
. - main() function is present in all C++ programs.
. - An object e1 is created in employee class. Using this e1 the functions present in the employee class are accessed and there by data are accessed.
. - The input namely ename and eno is got using the input statement namely cin and the values are outputted using the output statement namely cout.
Comments
saurabh Shah said:
| Nice to understand |
karthik.T said:
|
It is very easy to understand. |
Sachin Rudraksha said:
| This is very time saving and good for understading. |
suruli said:
| easy learning techniques |
Very gud ya said:
| Nice material |
Hicham said:
| Make hard stuff softer thank you |
Hicham said:
| Easy to understand. Very clear and concise. thank you |
R.A.Kalyani said:
| really superb!Anyone at the beginner level even can grasp. |
Ranjith kumar nuthakki said:
| good stuff for begineer's can easily understand by all the programmer's also |
Irshad1 said:
| These are very useful information for beginners related to oops |
swapna gajula said:
| Good information about OOPS concpts and very easy to understand in less time |
srilakshmi said:
| easy to understand ,thank u for the information |
raghavan said:
| very esay |
raghavan said:
| very esay to learn |
tera said:
| very esay & clear |
MMamgain said:
| It very good this one can understand and st the same time duplicate also.Thanks |
therasal said:
| easy to learn |
vidy said:
| easy to learn |
chhinnappa said:
| really interesting and easily to learn |
sakiriyas said:
| it is very easy to understand the concepts ,,as a learner this will lead to you in a right way get in to the deep in oops |
raja ramesh tadi said:
| easy to learn for fresh programmers |
Santhosh Kharvi said:
| Very easy to learn & Understanding, Thank u for information |
selvaraju.n said:
| very nice tounderstand |
Chandra Sekhar Puli said:
| All the oops concepts are covered in an easily understandable way. |
ganeshbabu said:
|
very easy to learn |
sumit123 said:
| Very well done |
prabhu1r said:
| It is very valuable to the user |
ANILOVE4u said:
| It's been a gr8 time to understand the oops very well. |
hdjkfhsd said:
| it is very useful for beginers |
Sudhaka Reddy K said:
| Easy to understand, Good for beginesrs |
Mahii said:
| Very useful material ,Its has been very clearly explained. |
amri665 said:
| very good!! 4 quick revision |
Manish.Kumarxl said:
| Very usefull info in less terms to understand the basic concept... :) |
Noorjakhan said:
| easy to understand |
PriyaPathak said:
|
This is very good. Thanks and regards. |
witcos said:
|
nice and easy to learn and undetstand Thanks Great Job |
saurabh jindal 9868769682 said:
| i was reading with the books but i was so confused, thanks for this tutorials. |
seethu said:
| really superb!! |
Mona said:
| This topic is very productive and easy to understand for every one. Keep it up !!!! |
VInothSathya(Rajapalayam) said:
| Easy to understand .Thanks..... |
anush said:
|
very useful information to students&users |
swapna hs said:
| it is very helpful,concepts are explained in a simple manner |
karan4u said:
| Great tutorials, for quick learning |
papa elie said:
| an important material that speeds up understanding |
pritt said:
| very useful and easy to learn |
sheetal.m.v said:
| it all depends how we use our logic |
somendra said:
| it should be more allobrate |
MANO said:
|
That is excellent material, which is used for beginers. THANK U |
Desh said:
|
Always Simply Superb .... illustrated with good example for objects... Thanks |
sntc99 said:
| what about dyanmic binding and message passing |
Ramesh Kumar A said:
| Good Explanation !!! |
Saaju said:
| Some examples that are needed |
gouthami said:
| there are certain features in the basics they r message passing and dynamic binding you missed them.otherwise nice explanation. |
mammay said:
| very good stuff |
radhika said:
| this is excellent material and Easy to understand. |
Aizaz Ahmad Khan Durrani said:
| that is good for a person who don't know about basic of oop. |
chennarao said:
| nice material easy to understand |
Rahul tyagi said:
| very easy & understand language i say thanks |
quanghoahcm said:
|
very good!!!thank very much!!!!!!!! |
gagan said:
|
Thank u. very good detail of concept of c++ |
aiyanar said:
| is very useful computer student in oop |
Datta said:
| It's very nice version.simple for understand every programmer |
k.uday bhaskar said:
| Details is very good |
Priya said:
|
Very easy to understand and simple. Thank u very much |
dhanesh said:
| nice and useful |
jayaprakashreddy said:
| what is meant by preprocessor directive |
tamrez alam said:
|
this matter is very easy for exams |
khemanand said:
| simple but not in detail . |
manish said:
|
thanks this is very simple and easy to understand... thanks |
sanjay said:
| learn very nice |
aditya said:
| explain the simple method to understand the oop in full vision |
Deepak said:
| this is very nice way to learn.. |
rakshita said:
|
thanks!!! its really very easy and understanding. |
0 said:
|
exact meaning is given in brief. it is very much helpful |
avinash dande said:
| It's easy n simple to understand for begineer's.But there shd be more pictures to full understand concept. |
Rama said:
| nice material |
Ravi said:
| An object represents a particular instance of a class, what is instance of class.....over object of class.how u can relate instance with object |
varsha said:
| it is a very nice material |
vikas nema said:
| An object represents a particular instance of a class, what is instance of class.....over object of class.how u can relate instance with object |
Ersalan said:
| Thanks a lot mate... One can just whisk through this to refresh their memory before an interview or something... Good Job! |
shazia naeem omari said:
| Thanks for making a language very easy to understand and pick good points very easily. Thanks a lot |
karthikeyan said:
| An object represents a particular instance of a class, what is instance of class over object of class. How you can relate instance with object. |
manisha said:
|
its really understanding and learnable. in which we easy to learn and understand the concept,thanx |
sadan Kumar said:
|
"An object represents a particular instance of a class. There can be more than one instance of an object." These two line is really confusing, Anyway it's a good material that gives quick understanding on OOPs. Thanks... |
Sponsored Links
