Menu

Overriding for Dummies

adjective

pronunciation: ,oʊvər'raɪdɪŋ

What does Overriding really mean?

52 1
52
Overriding is a word that we often use when we talk about making a decision or a choice that is stronger or more important than another one. It's like when you're playing a game and you have a special power or ability that allows you to take control and make your move, even if someone else wants to do something different. You're basically saying, "No, I'm in charge here!"

In a more technical sense, when we talk about "overriding" in programming, it means that we are changing or replacing something that was already there with something new. Think of it like working on a painting. You might start with a rough sketch and then add layers of paint on top to make the final picture. Sometimes, you might want to change one of those layers because you decide it doesn't look quite right. So, you take a new brush and paint over the old layer, replacing it with a fresh one. That's kind of what happens in programming when we talk about overriding.

Now, let's dive a bit deeper into the different meanings of "overriding" so we have a clear understanding. In everyday life, "overriding" can mean having control or being more important than something else. For example, when we talk about a parent overriding a child's decision, it means that the parent's decision is the one that counts and is more important. Similarly, when a law is overriding, it means that it takes priority over other laws and should be followed first.

In the programming world, on the other hand, "overriding" specifically refers to the concept of replacing or modifying a particular piece of code that was originally defined in a class or a function. It's like giving new instructions to the computer on what to do instead of following the original instructions. This can be really helpful when we want to customize or tweak the behavior of a program without changing the entire thing. By overriding certain parts, we can add our own special touches and make the program work the way we want it to.

To give you a simple example, let's say we have a base class called "Animal" with a method called "makeSound()". This method just prints "Generic animal sound." Now, let's say we have a subclass called "Dog" that inherits from the "Animal" class. We can override the "makeSound()" method in the "Dog" class and make it print "Woof!" instead. By doing this, whenever we create a Dog object and call the "makeSound()" method, it will display "Woof!" rather than the generic animal sound. The "Dog" class is overriding the behavior defined in the "Animal" class.

In summary, "overriding" means taking control or being more important than something else, whether it's in everyday life or in programming. It's like painting over an existing layer to replace it with something new or customizing the behavior of a program by replacing or modifying specific parts. So, next time you hear the term "overriding," you can think of it as being in charge and making changes to get the desired result. You're the boss!

Revised and Fact checked by James Brown on 2023-10-29 14:51:11

Overriding In a sentece

Learn how to use Overriding inside a sentece

  • When you are playing a game on your computer and you want to pause the game to answer an important phone call, you press the pause button. When you press the pause button, it overrides the game and stops it temporarily.
  • Imagine you are watching your favorite cartoon on TV, but suddenly your parent wants to watch the news instead. They can use the remote control to change the channel, and it will override the cartoon and show the news instead.
  • Sometimes, when you are playing music on your phone and your friend calls you, the ringing sound of the phone overrides the music and you can hear the ringtone instead.
  • Let's say you are writing an email on your computer, and while you are typing, your cat jumps on the keyboard. The cat's action overrides your typing and messes up the email.
  • Imagine you have a remote-controlled car and you are driving it forward. But suddenly, your little brother decides to press the stop button on the remote control. This will override the forward motion and make the car stop.

Overriding Synonyms

Words that can be interchanged for the original word in the same context.

Overriding Similar Words

Words that similar to the original word, but are not synonyms.