Brief analysis on several terms of C + +--overload, override, overwrite, rewrite

Source: Internet
Author: User

Overload, override, overwrite, rewrite these words often appear in C + + book, read some translated version found not to override, overwrite, rewrite strict distinction, mostly translated into rewrite. In fact, the English version of the original will find that different contexts are described in different words. The following is an analysis:

? Overload overloading

For this translation, there is no objection, perhaps it is because the overload translated into overloaded, resulting in the override directly translated into rewrite.

? Override Override

Many translations are translated into rewrite. I think this translation is ambiguous, in the end is completely re-write or retain the original method and then write a new one? Cannot literally understand its meaning. If the translation is covered or overwritten, and explains that override is only a separate implementation of the original method, the original method is not abandoned and will not be confused with overwrite. For example, suppose that the one.cpp and two.cpp two files are compiled simultaneously in a complete program with their respective program fragments as follows:

One.cpp
#include <iostream>
int dick = 10; External variable definition external variable definitions
...

Two.cpp
#include <iostream>
static int dick = 20; override external dick covers external variables dick
...

Dick in Two.cpp was covered by dick in the original one.cpp. But the original Dick was still there, but Dick was redefined in the two.cpp.

? Overwrite Erase Write

The people who equate overwrite and override on the Internet are everywhere, and think it is the meaning of rewriting. In fact, overwrite is the true meaning of the rewrite. If translated into erase, more at a glance, erase the original value, re-write in place. For example:

int x = 8;
x = 9; overwrite x with 9 (Erase X as 9)

Here, the original value of x 8 has been erased to 9. The original value 8 is replaced by 9.

? Rewrite rewrite

This word often appears in programming exercises where the topic requires rewriting an example or an instance. For example: "  Rewrite  this code without using break or continue. "or"   Rewrite  the following fragment using switch: "

The English-English dictionary interprets rewrite in English as: in order to improve it or change it. In order to improve or change it. The Chinese that are closer to rewrite are rewritten or polished. The rewrite here is for some reason re-written, the original write still valid.

Brief analysis on several terms of C + +--overload, override, overwrite, rewrite

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.