Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:00:35+00:00 2026-05-22T23:00:35+00:00

Does a set of functions doing exactly one word but differing in the name

  • 0

Does a set of functions doing exactly one word but differing in the name like atoi , atol, atoll etc called theoretically polymorphic?

For example I have a function say swap which needs to operate on different kind of data types. So i have one function/operation for which i have different implementations, but unfortunately because the language does not support using the same function name, to get such functionality i need to make variants swap_i , swap_l, swap_f, swap_str etc etc, and have to call them manually depending on the operands.

When designing the code, one would have designed this as one function, with different implementations, which are invoked depending upon the operands. But in this case the programmer instead of the compiler needs to make the static binding of the functions.
If the programmer implemented it in C++ then the design would be the same (as he/she has followed an OOD approach), but in this case the static binding could be done by the compiler without bothering the user.

Now, if in the design approach swap was a polymorphic function, will such a difference in C and C++ design implementation will make the difference, so that we cannot call such a C implementation not polymorphic and the C++ implementation polymorphic ?

EDIT1:

Another example:

say we send a union with different possible data types packed in and a structure wrapping it with a variable indicating which component of the union to be used. Then we can use only one function name swap without variants. After we receive the structure in the function, we can internally do operations depending on the datatype active in the union

  struct _generic {
     int type;
     union {
              int a;
              float b;
              char c;
     } component;
  } variable;

  swap (struct _generic var2, struct _generic var1)
  {
     if (var1.type == INTEGER)
     {
         /* code for integer */
     }
     else if (var1.type == FLOAT)
     {
        /* code for float */
     }
      .
      .
      .
  }

In this case we use another way.

Also note the ellipses operator ... like in printf with this also we can get some builtin feature.

The main point is that, C language does not provide direct implementation of OOD s , but can we use the OOD terminology on the implementation on the C implementation, if it is designed by following an object oriented design?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:00:36+00:00Added an answer on May 22, 2026 at 11:00 pm

    In my opinion it is not incorrect, because the polymorphism and other object oriented terminologies are not something which is language dependent, and is a concept. Now, different languages provide different features with which the implementation of an object model is much easier, and some features are only possible which were not possible in other languages.

    If one problem was modelled with OOD approach, and the same model is followed to make an implementation with C and C++ keeping the approach identical, where the difference only comes from the limited feature set of the language, and then they are compiled then both generate assembler code. The C++ outputs for a polymorphic function are not polymorphic anymore after it is converted to the asm.

    The difference is that C does not provide features to implement OOD as easier as it can be done in C++ or other OOP languages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know how to unbind set of event handlers, but memorize them in
Does anyone know how to set the code text editor font style to italics
Does anyone know how to set up a default querystring to an asp.net webform
Does anyone know of a set of bindings for C# to drive the FFMpeg
Does there exist a website service or set of scripts that will tell you
Does the order in which I set properties using the object initializer syntax get
Does anyone know if there is a good equivalent to Java's Set collection in
How does the Chinese GB18030 code set differ from Unicode? What special techniques are
Does hitting the back button in a web browser cause the session data set
So essentially does margin collapsing occur when you don't set any margin or padding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.