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 copy constructor?
The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor is used to: Initialize one object...
Hiteshwar
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

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
What is a class?
Class is User defined data type, its contain data members and member function
Thinagaran
0 0
7
What is different between malloc and calloc?
The Diffrences are like-- malloc() takes a single argument (memory required in bytes), while calloc() needs two arguments. Secondly, malloc() does not initialize the memory allocated, while calloc() initializes...
Roopali

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

Ask a Question

Related Lessons

How do i get best Campus / Off Campus Placement?
Companies are looking for Skilled Freshers. So build your technical skills while doing MCA / BTech / BCA / BSc (IT or CS) into below areas- 1. Strong your programming & debugging skills ...

Callback using Function Pointer (in C), interface (in Java) and EventListener pattern
Note : Read the original document at http://som-itsolutions.blogspot.in/2017/01/blog-post_24.html “In computer programming, a callback is a reference to executable code, or a piece of executable...

Contents Of C++ Programming
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....

Efficient Learning Strategies
Type your notes after class Write your notes onto flashcards - Scrabble -Make posters Review flashcards while walking, at gym, etc. Dog-ear pages in the reading where you can find...

C++ Advanced Course Study With C++11 Features
OOPS(Object Oriented Programming Systems) In C++. Types of Languages 2GL(Basic,Instruction programming to microprocessors/MC), 3GL(COBOL(= EQUALS TO),C++,C,PASCAL,Java,C#) 4GL(HTML,CSS,JSON) Style...

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 >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

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 >

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