Thread: Is it possible function overrriding in c?

  1. #1
    kotin
    Join Date
    Oct 2009
    Posts
    132

    Is it possible function overrriding in c?

    I know that c++ supports function overriding . But we can do function overriding in c also?

    I fell that its not possible in C. Can any one give your comments on this?

    Thanks in advance.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It is not natively possible in C, but as a matter of course when fully simulating OOP in C, it can be done, e.g., by implementing a virtual function table.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    No, it is not possible.

    Quite a few people confuse the concepts of function overriding and function overloading. However, regardless of which one you have in mind, C supports neither.

    It is possible to simulate the behaviours, but the capabilities are not native to C.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 06-09-2009, 02:19 AM
  2. Print function: sending a function.. through a function?
    By scarlet00014 in forum C Programming
    Replies: 3
    Last Post: 11-05-2008, 05:03 PM
  3. Replies: 14
    Last Post: 03-02-2008, 01:27 PM
  4. Replies: 9
    Last Post: 01-02-2007, 04:22 PM
  5. Overrriding
    By siavoshkc in forum C# Programming
    Replies: 3
    Last Post: 10-06-2006, 11:21 PM