Signup as a Tutor

As a tutor you can connect with more than a million students and grow your network.

C++ Language classes Fees

Estimated Fees in India

₹ 1,500 to ₹ 4,000 per month

Find C++ Language classes Fees in your locality

Please select a locality

or Get Free Quotes*

* Tutors will contact you with custom quotes as per your need

Estimated fees for C++ Language classes in

  • LOCALITIES FEE RANGE

Find Tutors in

Map View

Estimated fees in

Find Tutors in

Estimated fees for C++ Language classes in top cities

Click for more

₹ 3,000 to ₹ 5,000

Click for more

₹ 1,500 to ₹ 5,000

Click for more

₹ 1,200 to ₹ 3,500

Click for more

₹ 1,500 to ₹ 4,000

Click for more

₹ 3,000 to ₹ 4,000

Click for more

₹ 2,800 to ₹ 5,000

How UrbanPro works

Post your requirements or browse our professional network

Get customized quotes and responses for your learning requirement

Choose & Connect with the expert of your choice

Best C++ Language classes experts to choose from

Post your requirements now

Dr. Shyam Chawda

Venkatesh S

Umasankar Natarajan

Besant Technologies

Trishana Technologies

Compufield

Best C++ Language classes experts to choose from

Post your requirements now

Trending discussions on C++ Language classes

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

Polymorphism In C++

Ajit Deshmukh

I am working as a Subject Matter Expert in SEEED INFOTECH for C and C++ programming.

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... 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,...

Answer

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[2] or the ISO C standard 5.1.2.2.1. A conforming implementation accepts int main() { /* ... */ } Even if your compiler accepts “void main()”... 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

Join Discussions

Post your Requirement

Connect with the best tutors or institutes

Please enter your name.

Please enter valid email

Please enter valid 10 digit Phone Number

Please enter the Pin Code.

Which location would you prefer for C++ Language?

Please select at least one option from Class Location.

By signing up, you agree to our Terms of Use and Privacy Policy.

You Already have an UrbanPro Account

Please Login to continue

Please Enter valid Email or Phone Number

Please Enter your Password

Please enter the OTP sent to your registered mobile number.

Please Enter valid Password or OTP

Forgot Password? Resend OTP OTP Sent

Sorry, we were not able to find a user with that username and password.

We have sent you an OTP to your register email address and registered number. Please enter OTP as Password to continue