C++ Language

C++ Language

Trending Questions and Lessons

Follow 42,572 Followers

Ask a Question

Feed

All

All

Lessons

Discussion

Answered on 30 May IT Courses/Programming Languages/C++ Language/Basic C++

I preferred NCERT & R.d Sharma for Mathematics.I preferred S. Chand for Science & Follow the... read more

I preferred NCERT & R.d Sharma for Mathematics.
I preferred S. Chand for Science & Follow the NCERT question from NCERT.

read less

N. K Mishra

Tutor

Yes I can do this.
Answers 1 Comments
Dislike Bookmark

Lesson Posted on 10 Mar IT Courses/Programming Languages/C++ Language

Contents Of C++ Programming

Vilas Dongre

I have 16 years of experience in IT training with C , CPP, C#, ASP.NET. Also taken batches at various colleges.

1. History of CPP 2. Concepts of OOP's 3. Introduction and Features of CPP (OOP's) 4. Characteristics of OOP's 5. CPP Keywords 6. Major Components of CPP: Encapsulation Inheritance Polymorphism 7. Limitations 8. Programs: Default Arguments Inline Function Function... read more
1. History of CPP
 
2. Concepts of OOP's
 
3. Introduction and Features of CPP (OOP's)
 
4. Characteristics of OOP's
 
5. CPP Keywords
 
6. Major Components of CPP:
  • Encapsulation
  • Inheritance
  • Polymorphism
7. Limitations
 
8. Programs:
  • Default Arguments
  • Inline Function
  • Function Overloading
  • Scope Resolution Operator
9. Reference Variable
 
10. Class:
  • Instance
  • Constructor
  • Copy Constructor
  • Distructor
11. Static Data Member
 
12. Static Member Function
 
13. Friend Function
 
14. Encapsulation
 
15. Inheritance:
  • Single Inheritance
  • Types of Visibility Labels
  • Effect of Visibility Labels
  • Multiple Inheritance
  • Multilevel Inheritance
  • Multipath Inheritance
  • Hybrid Inheriance
16. Polymorphism:
  • Runtime Polymorphism
  • Function Overloading
  • Operator Overloading
17. Compile Time:
  • Polymorphism
  • Virtual Function
  • Pure Virtual Function
18. Dynamic Memory Allocation
 
19. Templates
 
20. Generic Functions
 
21.File Handling
read less
Comments
Dislike Bookmark

Lesson Posted on 05 Mar Tuition/BA Tuition/C++ Programming IT Courses/Programming Languages/C++ Language

C++ Overview

Namrata

Introduction: C++ is the first object oriented programming language used universally as an advanced version of C language. Many features such as Inheritance, Class & Object, Polymorphism(Function overloading) etc are introduced in C++ which are not available in C Language. There are many differences... read more

Introduction:

C++ is the first object oriented programming language used universally as an advanced version of C language. Many features such as Inheritance, Class & Object, Polymorphism(Function overloading) etc are introduced in C++ which are not available in C Language.

There are many differences between C & C++ few are mentioned below:

Difference between C & C++:

C

C++

C supports procedural programming paradigm for code developmen

C++ supports both procedural and object oriented programming paradigms; therefore C++ is also called a hybrid language.

Follows top-down approach.

Follows bottom up approach.

C is a subset of C++. It cannot run C++ code.

C++ is a superset of C. C++ can run most of C code while C cannot run C++ code.

Function-driven language

Object-driven language

Low-level language

Middle-level language

C requires one to declare all the variables at the top of the program.

In C++, the variables can be declared anywhere in the program before use.

The default header file used in C language is stdio.h

The default header file used in C++ is iosteam.h

The features which are supported in C++ and not available in C Language:

Functions inside Structure:

In case of C++, functions can be used inside a structure while structures cannot contain functions in C.

Classes and Objects:

Class is a user defined datatype which contains member variables and member functions.

Object is a instance of defined class which helps to access member variable and member functions of the class.

We can define as many objects as we can for one class.

Function Overloading:

Function overloading is also known as a Polymorphism. Function overloading enables programmer to use same function name for multiple time(with different definition) through out the program.

Inheritance:

Inheritance is the capability of one class to acquire properties and characteristics from another class. The class whose properties are inherited by other class is called the Parent or Base or Super class. And, the class which inherits properties of other class is called Child or Derived or Sub class.

Constructor and Destructor:

A class constructor is a special member function of a class that is executed whenever we create new objects of that class. Constructor has the same name as class name. 

A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the delete expression is applied to a pointer to the object of that class. Destructor also has the same name as class name but only declared with tilde sign (~) before the declaration.

C++ has  many other features such as namespace, exception handling, reference variable etc. More detailed information will be covered in upcoming articles.

read less
Comments
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Lesson Posted on 07 Feb IT Courses/Programming Languages/C++ Language

Polymorphism In C++

Ajit Deshmukh

Currently working with CRB Tech Solutions pvt ltd as a Trainer for C, C++ Data Structure and Core Java. Worked...

Basically polymorphism represents poly means many and morph means forms that many forms. In which we are passing same message to different objets but every object will work for that message in their own manner. Means message is same but implementaion is different. Take an real life example: Suppose... read more

Basically polymorphism represents poly means many and morph means forms that many forms.

In which we are passing same message to different objets but every object will work for that message in their own manner. Means message is same but implementaion is different.

Take an real life example:

Suppose I have set of 50 LED TV's. There are two cases.

Case 1: Each tv has seperate remote but it is very difficult for me to manage each tve remote.

Case 2: I can use common remote to manage all LED Tv's. So it is very esay for me to manage all tv's with the help of common remote.

So second case represents polymorphism concept. We are providing common message but its implementaion is different.

Before going to polymorphism we will understand what is mean by binding.Binding represents association of object with function. There are two types of binding:

1. Compile time binding (Early binding or static binding): At compile time, binding takes place that will be representd as compilr time binding.

2. Run time binding (Late binding or dynamic binding): At run time,  binding takes place that will be represented as run time biding.

So we have to understood the concept of run time binding before that we need to understand two concepts.

1. Function overloading: Same function name but different signature represents function overloading. It will always takes place into same classes. Signature means may be no of parameters,sequence and its return type may be different.

2. Function overriding: All things of function(Function name,signature, return type) are same then it will be represented as function overriding. But function overriding always takes place in to different classes.

For example:

class A

{

       public:

                void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

Class B : public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

 

So In above example void show() function represents Function overrding concept. Function overriding always takes place into different classes when we are using inheritance concept.

Now let's see polymorphism concept:

For example:

class A

{

       public:

                void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

class B: public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

 

 

void main()

{

          A  *p;                   //base class pointer

          B  bObj;              //object of derived class

          p = &bObj;         //assigned address of class B object to base class pointer p.

          p->show();        //Trying to call derived class function withe the help of base class pointer.

}

 

In above example I am trying to call function of dereived class B. But here compile time binding takes place. Here compiler calls base class function because the compilre will check type of pointer. So we have declared pointer is type of Class A. Here compilre is not going to consider what address stored within pointer. It will just consider what type of pointer we have created and it will call base class function.

So how to resolve this problem. So for that we need to apply run time polymeophsim. In C++ run time polymeorphism is achieved by using virtual keyword. Here we have to just make base class function as  virtual. No need to use virtual keyword for each overrided function. Need to make base class function as virtual. Here all ovrrided function automatically made virtual because we using inheritance concept.

If we are using function overriding then and then your derived classes functins become virtual.

So just consider following change in above same example.We are just making void show() function of base class A as a virtual.

For example:

class A

{

       public:

                virtual  void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

class B : public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

void main()

{

          A  *p;                   //base class pointer

          B  bObj;              //object of derived class

          p = &bObj;         //assigned address of class B object to base class pointer p.

          p->show();        //It will call appropriate function of class B.

}

 

So now we will get expected output because we have applied run time polymorphism. We have just made base class function as a virtual. Now compiler going to check at run time what type of address we have stored within this base class pointer. So it will call appropriate function of derived class.

So in this way we have achieved polymorphism with the help of virtual keyword. So we are calling here derived classes function with the help of base class pointer.

read less
Comments
Dislike Bookmark

Asked on 22/12/2017 IT Courses/Programming Languages/C++ Language/Basic C++

I need to learn English but there are some issues on own my mind, like grammar mistake, spelling mistake,... read more
I need to learn English but there are some issues on own my mind, like grammar mistake, spelling mistake, hesitation for speaking English, etc. So how to removed these issue, give me suggestion! read less

Answer

Lesson Posted on 04/10/2017 IT Courses/Programming Languages/C++ Language/Advanced C++

C Programming Language Basics - Easy way to learn

B.v.v. Satyanarayana Rao

I have 5 years of Teaching Experience in Engineering college.

Computer - OverviewTodays world is an information-rich world and it has become a necessity for everyone to know about computers. A computer is an electronic data processing device, which accepts and stores data input, processes the data input, and generates the output in a required format.The purpose... read more

Computer - Overview
Todays world is an information-rich world and it has become a necessity for everyone to know about computers. A computer is an electronic data processing device, which accepts and stores data input, processes the data input, and generates the output in a required format.
The purpose of this tutorial is to introduce you to Computers and its fundamentals.
Functionalities of a Computer
If we look at it in a very broad sense, any digital computer carries out the following five functions −
Step 1 − Takes data as input.
Step 2 − Stores the data/instructions in its memory and uses them as required.
Step 3 − Processes the data and converts it into useful information.
Step 4 − Generates the output.
Step 5 − Controls all the above four steps.


Advantages of Computers
Following are certain advantages of computers:

  • High Speed - Computer is a very fast device. It is capable of performing calculation of very large amount of data. The computer has units of speed in microsecond, nanosecond, and even the pico second. It can perform millions of calculations in a few seconds as compared to man who will spend many months to perform the same task.
  • Accuracy - In addition to being very fast, computers are very accurate. The calculations are 100% error free. Computers perform all jobs with 100% accuracy provided that the input is correct.
  • Storage Capability - Memory is a very important characteristic of computers. A computer has much more storage capacity than human beings. It can store large amount of data. It can store any type of data such as images, videos, text, audio, etc.
  • Diligence - Unlike human beings, a computer is free from monotony, tiredness, and lack of concentration. It can work continuously without any error and boredom. It can perform repeated tasks with the same speed and accuracy.
  • Versatility - A computer is a very versatile machine. A computer is very flexible in performing the jobs to be done. This machine can be used to solve the problems related to various fields. At one instance, it may be solving a complex scientific problem and the very next moment it may be playing a card game.
  • Reliability - A computer is a reliable machine. Modern electronic components have long lives. Computers are designed to make maintenance easy.
  • Automation - Computer is an automatic machine. Automation is the ability to perform a given task automatically. Once the computer receives a program i.e., the program is stored in the computer memory, then the program and instruction can control the program execution without human interaction.
  • Reduction in Paper Work and Cost - The use of computers for data processing in an organization leads to reduction in paper work and results in speeding up the process. As data in electronic files can be retrieved as and when required, the problem of maintenance of large number of paper files gets reduced. Though the initial investment for installing a computer is high, it substantially reduces the cost of each of its transaction.

Disadvantages of Computers
Following are certain disadvantages of computers.

  • No I.Q. - A computer is a machine that has no intelligence to perform any task. Each instruction has to be given to the computer. A computer cannot take any decision on its own.
  • Dependency - It functions as per the users instruction, thus it is fully dependent on humans.
  • Environment - The operating environment of the computer should be dust free and suitable.
  • No Feeling - Computers have no feelings or emotions. It cannot make judgment based on feeling, taste, experience, and knowledge unlike humans.

Computer - Applications

  • Business - A computer has high speed of calculation, diligence, accuracy, reliability, or versatility which has made it an integrated part in all business organizations. Computer is used in business organizations for −
  1. Payroll calculations
  2. Budgeting
  3. Sales analysis
  4. Financial forecasting
  5. Managing employee database
  6. Maintenance of stocks, etc.
  • Banking - Today, banking is almost totally dependent on computers. Banks provide the following facilities −
  1. Online accounting facility, which includes checking current balance, making deposits and overdrafts, checking interest charges, shares, and trustee records.
  2. ATM machines which are completely automated are making it even easier for customers to deal with banks.
  • Insurance - Insurance companies are keeping all records up-to-date with the help of computers. Insurance companies, finance houses, and stock broking firms are widely using computers for their concerns. Insurance companies are maintaining a database of all clients with information showing −
  1. Procedure to continue with policies
  2. Starting date of the policies
  3. Next due installment of a policy
  4. Maturity date
  5. Interests due
  6. Survival benefits
  7. Bonus
  • Education - The computer helps in providing a lot of facilities in the education system. The computer provides a tool in the education system known as CBE (Computer Based Education) CBE involves control, delivery, and evaluation of learning. Computer education is rapidly increasing the graph of number of computer students. There are a number of methods in which educational institutions can use a computer to educate the students. It is used to prepare a database about performance of a student and analysis is carried out on this basis.
  • Marketing - In marketing, uses of the computer are following −
  1. Advertising − With computers, advertising professionals create art and graphics, write and revise copy, and print and disseminate ads with the goal of selling more products.
  2. Home Shopping − Home shopping has been made possible through the use of computerized catalogues that provide access to product information and permit direct entry of orders to be filled by the customers.
  • Healthcare - Computers have become an important part in hospitals, labs, and dispensaries. They are being used in hospitals to keep the record of patients and medicines. It is also used in scanning and diagnosing different diseases. ECG, EEG, ultrasounds and CT scans, etc. are also done by computerized machines. Following are some major fields of health care in which computers are used.
  1. Diagnostic System − Computers are used to collect data and identify the cause of illness.
  2. Lab-diagnostic System − All tests can be done and the reports are prepared by computer.
  3. Patient Monitoring System − These are used to check the patient's signs for abnormality such as in Cardiac Arrest, ECG, etc.
  4. Pharma Information System − Computer is used to check drug labels, expiry dates, harmful side effects, etc.
  5. Surgery − Nowadays, computers are also used in performing surgery.
  • Engineering Design - Computers are widely used for Engineering purpose. One of the major areas is CAD (Computer Aided Design) that provides creation and modification of images. Some of the fields are −
  1. Structural Engineering − Requires stress and strain analysis for design of ships, buildings, budgets, airplanes, etc.
  2. Industrial Engineering − Computers deal with design, implementation, and improvement of integrated systems of people, materials, and equipment.
  3. Architectural Engineering − Computers help in planning towns, designing buildings, determining a range of buildings on a site using both 2D and 3D drawings.
  • Military - Computers are largely used in defence. Modern tanks, missiles, weapons, etc. Military also employs computerized control systems. Some military areas where a computer has been used are −
  1. Missile Control
  2. Military Communication
  3. Military Operation and Planning
  4. Smart Weapons
  • Communication - Communication is a way to convey a message, an idea, a picture, or speech that is received and understood clearly and correctly by the person for whom it is meant. Some main areas in this category are −
  1. E-mail
  2. Chatting
  3. Usenet
  4. FTP
  5. Telnet
  6. Video-conferencing
  • Government - Computers play an important role in government services. Some major fields in this category are −
  1. Budgets
  2. Sales tax department
  3. Income tax department
  4. Computation of male/female ratio
  5. Computerization of voters lists
  6. Computerization of PAN card
  7. Weather forecasting 


Computer - Generations
Generation in computer terminology is a change in technology a computer is/was being used. Initially, the generation term was used to distinguish between varying hardware technologies. Nowadays, generation includes both hardware and software, which together make up an entire computer system.
There are five computer generations known till date. Each generation has been discussed in detail along with their time period and characteristics. In the following table, approximate dates against each generation has been mentioned, which are normally accepted.

Following are the main five generations of computers.
1 First Generation
The period of first generation: 1946-1959. Vacuum tube based.

2 Second Generation
The period of second generation: 1959-1965. Transistor based.

3 Third Generation
The period of third generation: 1965-1971. Integrated Circuit based.

4 Fourth Generation
The period of fourth generation: 1971-1980. VLSI microprocessor based.

5 Fifth Generation
The period of fifth generation: 1980-onwards. ULSI microprocessor based.


Computer - First Generation
The period of first generation was from 1946-1959. The computers of first generation used vacuum tubes as the basic components for memory and circuitry for CPU (Central Processing Unit). These tubes, like electric bulbs, produced a lot of heat and the installations used to fuse frequently. Therefore, they were very expensive and only large organizations were able to afford it.
In this generation, mainly batch processing operating system was used. Punch cards, paper tape, and magnetic tape was used as input and output devices. The computers in this generation used machine code as the programming language.
The main features of the first generation are −

  • Vacuum tube technology
  • Unreliable
  • Supported machine language only
  • Very costly
  • Generated a lot of heat
  • Slow input and output devices
  • Huge size
  • Need of AC
  • Non-portable
  • Consumed a lot of electricity

Some computers of this generation were −
ENIAC, EDVAC, UNIVAC, IBM-701, IBM-650

Computer - Second Generation
The period of second generation was from 1959-1965. In this generation, transistors were used that were cheaper, consumed less power, more compact in size, more reliable and faster than the first generation machines made of vacuum tubes. In this generation, magnetic cores were used as the primary memory and magnetic tape and magnetic disks as secondary storage devices.
In this generation, assembly language and high-level programming languages like FORTRAN, COBOL were used. The computers used batch processing and multiprogramming operating system.
The main features of second generation are −

  • Use of transistors
  • Reliable in comparison to first generation computers
  • Smaller size as compared to first generation computers
  • Generated less heat as compared to first generation computers
  • Consumed less electricity as compared to first generation computers
  • Faster than first generation computers
  • Still very costly
  • AC required
  • Supported machine and assembly languages

Some computers of this generation were −
IBM 1620, IBM 7094, CDC 1604, CDC 3600, UNIVAC 1108

Computer - Third Generation
The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with the associated circuitry.
The IC was invented by Jack Kilby. This development made computers smaller in size, reliable, and efficient. In this generation remote processing, time-sharing, multiprogramming operating system were used. High-level languages (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.) were used during this generation.
The main features of third generation are −

  • IC used
  • More reliable in comparison to previous two generations
  • Smaller size
  • Generated less heat
  • Faster
  • Lesser maintenance
  • Costly
  • AC required
  • Consumed lesser electricity
  • Supported high-level language

Some computers of this generation were −
IBM-360 series, Honeywell-6000 series, PDP (Personal Data Processor), IBM-370/168, TDC-316


Computer - Fourth Generation
The period of fourth generation was from 1971-1980. Computers of fourth generation used Very Large Scale Integrated (VLSI) circuits. VLSI circuits having about 5000 transistors and other circuit elements with their associated circuits on a single chip made it possible to have microcomputers of fourth generation.
Fourth generation computers became more powerful, compact, reliable, and affordable. As a result, it gave rise to Personal Computer (PC) revolution. In this generation, time sharing, real time networks, distributed operating system were used. All the high-level languages like C, C++, DBASE etc., were used in this generation.
The main features of fourth generation are −

  • VLSI technology used
  • Very cheap
  • Portable and reliable
  • Use of PCs
  • Very small size
  • Pipeline processing
  • No AC required
  • Concept of internet was introduced
  • Great developments in the fields of networks
  • Computers became easily available

Some computers of this generation were −
DEC 10, STAR 1000, PDP 11, CRAY-1(Super Computer), CRAY-X-MP(Super Computer)

Computer - Fifth Generation
The period of fifth generation is 1980-till date. In the fifth generation, VLSI technology became ULSI (Ultra Large Scale Integration) technology, resulting in the production of microprocessor chips having ten million electronic components.
This generation is based on parallel processing hardware and AI (Artificial Intelligence) software. AI is an emerging branch in computer science, which interprets the means and method of making computers think like human beings. All the high-level languages like C and C++, Java, .Net etc., are used in this generation.
AI includes −

  • Robotics
  • Neural Networks
  • Game Playing
  • Development of expert systems to make decisions in real-life situations
  • Natural language understanding and generation

The main features of fifth generation are −

  • ULSI technology
  • Development of true artificial intelligence
  • read less
Comments
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Answered on 26/08/2017 IT Courses/Programming Languages/C++ Language/Advanced C++ IT Courses/Programming Languages/C++ Language/Basic C++ Tuition/BA Tuition/C++ Programming +1 IT Courses/Programming Languages/C Language less

SOMA M.

Computer Wizard

If you will need tuition of c++, then kindly mail me or call me.
Answers 4 Comments
Dislike Bookmark

Lesson Posted on 13/07/2017 IT Courses/Programming Languages/C++ Language/Advanced C++ IT Courses/Programming Languages/C++ Language/Basic C++ Tuition/BCA Tuition/C Language Programming +2 IT Courses/Programming Languages/C Language Tuition/Engineering Diploma Tuition/Basics of C Programming less

Is It Fine To Write void main() Or main() In C/C++?

Sunil Yadav

I am an experienced, qualified teacher of 8 years experience in teaching Mathematics, Physics and Computer...

The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming implementation accepts int main() { /* ... */ } Even if your compiler accepts... read more

The definition:

void main() { /* ... */ }

Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1. A conforming implementation accepts

int main() { /* ... */ }
 
Even if your compiler accepts “void main()” avoid it, or risk being considered ignorant by C and C++ programmers.
In C++, main() need not contain an explicit return statement. In that case, the value returned is 0, meaning successful execution.

Note also that neither ISO C++ nor C99 allows you to leave the type out of a declaration. That is, in contrast to C89 and ARM C++ ,”int” is not assumed where a type is missing in a declaration. Consequently:

#include
 
main() { /* ... */ }

is an error because the return type of main() is missing.

It is never a good idea to use “void main()” or just “main()” as it doesn’t confirm standards.

It may be allowed by some compilers though.

read less
Comments 2
Dislike Bookmark

Answered on 26/09/2015 IT Courses/Programming Languages/C++ Language

Kartik Agrawal

Software Developer, Expertise in Java/J2ee Technology.

It is a header file, which is needed to be included in C++ program to perform input output operations.
Answers 26 Comments 5
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Answered on 29/01/2015 IT Courses/Programming Languages/C++ Language

Manoj Kumar Vishwakarma

MS SQL DBA Trainer

On the basis of his total experience and Qualification you can do it.
Answers 34 Comments
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best C++ Language classes in India. Post Your Requirement today and get connected.

Overview

Questions 91

Lessons 58

Total Shares  

Top Contributors

Connect with Expert Tutors & Institutes for C++ Language

x

Ask a Question

Please enter your Question

Please select a Tag

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more