overloading in C

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • uday

    #1

    overloading in C

    Does C supports overloading. I am thinking no. But some people are
    saying yes. If yes how. Please answer with examples.

    Also in c++ size of empty class is one. why. and what are the
    default methods created in a class. These questions are asked in
    interviews. so please explain.

  • Ulrich Eckhardt

    #2
    Re: overloading in C

    uday wrote:[color=blue]
    > Does C supports overloading. I am thinking no.[/color]

    And you are right.
    [color=blue]
    > Also in c++ size of empty class is one. why.[/color]

    Every object needs to have a unique address in C or C++, so it needs at
    least one byte assigned to it. You can have 'empty baseclass optimization'
    in C++ though, so it doesn't always really take up that storage.
    [color=blue]
    > and what are the default methods created in a class.[/color]

    You are aware of where you are asking this, right? So let me just tell you
    that the (de)fault ones are the ones required for C struct compatibility,
    to stay at least mildly on topic.

    Uli

    Comment

    Working...