Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-07-2007, 03:12 AM
Patrick Patrick is offline
Programmer
 
Join Date: Sep 2007
Posts: 100
Rep Power: 5
Patrick is on a distinguished road
Default Virtual Functions ????

Please explain the concept of virtual functions using a simple example and how its working is different from that of normal functions . Is there any special syntax for declaring these functions except the use of keyword Virtual
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-07-2007, 10:54 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,650
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Code:
// Making an interface for deriving classes
class Base
{
    public:
        // Deriving classes have to override the following function
        virtual void foo() = 0;
};

// A class deriving from the base class
class Derived
    : public Base
{
    public:
        // Overrides and implements the function now
        void foo() { /* do something... */ }
};

// ...

Derived *dObj = new Derived;
// Use it in some way
delete dObj;
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flex, bison multifunction calculator annatsos C and C++ 1 01-04-2007 07:00 AM
Virtual Server Blaze Hosting and Registrars 10 01-04-2007 03:09 AM
Functions??? elfshadow14 C and C++ 3 12-31-2006 04:10 PM
Code:PHP Random Functions John PHP Tutorials 2 12-03-2006 11:04 AM
Get and Set Functions Chan C# Programming 3 08-25-2006 12:44 PM


All times are GMT -5. The time now is 03:55 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%

Ads