UrbanPro

Learn C++ Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

what is method over-riding and how it is used ? if possible send with code with output or screen photo ?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

Programing Hub/Trainer

Method over-riding : it is a technique in which more then one function with same name and same signature( similar type parameter) can present in program. in overriding a subclass method overrides the definition of base class method code and output mentioned in screenshot
Comments

Creative Magician

first i will explain in a easy way about the overridding to change the functionality of a particular method in every child class compare to the parent class for example.. you want to prepare a biryani.. in parent class(Home,House) their a simple casual method to prepare biryani but in every...
read more
first i will explain in a easy way about the overridding to change the functionality of a particular method in every child class compare to the parent class for example.. you want to prepare a biryani.. in parent class(Home,House) their a simple casual method to prepare biryani but in every child class(different restaurants) means in every restaurant they follow their own methodology compare to home recipe means parent class.. code in java for method overridig.. public class BiryaniH { public void prepare() { System.out.println("biryani is ready"); } } public class RestaurantOne extends BiryaniH { public void prepare() { System.out.println("biryani is ready at R1"); } } public class RestaurantTwo extends BiryaniH { void public void prepare() { System.out.println("biryani is ready at R2"); } } public class TestBiryni { public static void main(String args[]) { RestaurantOne obj1 = new RestaurantOne(); obj1.prepare(); RestaurantTwo obj2 = new RestaurantTwo(); obj2.prepare(); } } read less
Comments

Expert Technical Trainer with 15 years of work experience

You can try Virtual functions
Comments

10 years of Experience in C, C++, Device Driver, Boot Code, Embedded Systems, RTOS. Motivational Speaker and Project Manager

This allows same function name to be made to behave according to child class or sub class needs. Virtual functions are best example for this.
Comments

C++, Data Structures, Software Engineering working professional.

Dear Sayyad, Never understand the classes in terms of Child and Parent, Consider them as extensions, like for example, Suppose you have a basic class (which provides some functionality via methods), which everybody is free to use, now imagine if somebody wants to provide own version of one of the...
read more
Dear Sayyad, Never understand the classes in terms of Child and Parent, Consider them as extensions, like for example, Suppose you have a basic class (which provides some functionality via methods), which everybody is free to use, now imagine if somebody wants to provide own version of one of the methods, what are the options available. #1 Change the method in base class, which u have implemented. (Bad idea, because it will break the existing code). #2 Don't touch the class, which is in use and working, Derive a new class, and provide a new definition to the method, which u want to do differently. (Good idea, it'll not break anything), A real world example would be ... class Account { public : bool Deposit(Double amount); } class SavingAccount : public Account { public : bool Deposit(Double amount); } class CurrentAccount : public Account { public : bool Deposit(Double amount); } Do not try to copy paste and compile, this is just a pseudo-code. The explanation can continue, and we can take many more examples, where Method Overriding is used in real world. read less
Comments

View 3 more Answers

Related Questions

What is the main difference between returning value of a function and does not return any value of a function in  C. Which is correct void main(void), int main(void), int main(int) , or void main(int) and explain the main difference between int main() and int main(void). 

A function may or may not return a value to the calling function. If the function is returning a value, then you have to mention the data type in the function definition and funtion declaration (like int,...
Mahesh Kondawar
Is C#, C++, Python, or JS better for game development?
All languages good for gamjng. But you can make 3d games in c# uaing unity software and it's very very interesting to work on it.
Mohit
0 0
6
Is C/C++ language is still important in 2019?
Of course, C language is only the heart of any processor or controller.Because of complexity in C peoples are looking to work on High-level languages like JAVA etc.
Tejas
0 0
7
Describe about private access specifier?
Private keyword, means that no one can access the class members declared private outside that class. By default class variables and member functions are private.
Prasad
1 1
8
Explain about member functions?
Member functions are part of the class, member functions are used to access, member variable in private, protected, public area and also call another member functions.
Zeeshan
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Compare C And C++ In Terms Of Header Files.
1."stdio.h" in c program controls input-output functionalities and operations associated with it where as in c++ program iostream.h" controls input-output functionalities and operations associated with...

C++ Program Sample Application
//Standard Library Functions(Headers Files Used in C++) #include<iostream.h> #include<conio.h> //Main function int main() { //function for clearing the screen clrscr(); //function for...
S

Memory Layout in C++ vis-a-vis Polymorphism and Padding bits.
I know there is no need for the knowledge of memory layout for a normal day-to-day development of C++. However, when someone goes in the bit/byte level of C++, he needs to look for such discussion. To...

Swapping Two Numbers
Q. Swap two numbers using the following function. Complete the function. You won't be allowed to use a temporary variable to swap the two numbers. void swap ( ... ) { /* Swap code goes here */ } ...

C Programming Language Basics - Easy way to learn
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...

Recommended Articles

Introduction C++ is an excellent programming language and many of the applications are written in C++ language. It has generic, object-oriented & imperative programming features, and also provides facilities for low-level memory manipulation. Successor of C language, it is an OOP (object oriented programming) language...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Looking for C++ Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 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 7.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