Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
|
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 5th, 2004, 07:23 AM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Visual C++ .NET: A primer for C++ developers error

On page 51, when discussing abstract classes, it says that writing default implementations for all methods in abstract classes is not possible using C++'s pure virtual syntax.

That's not true.

Try the following C++:

--------8<--------
#include <iostream>

struct base {
    virtual void f() = 0;
};

void base::f()
{
    std::cout << "base::f() called\n";
}

struct derived : public base {
    void f();
};

void derived::f()
{
    std::cout << "derived::f() called\n";
    base::f();
}

int main()
{
    derived d;
    d.f();
}
--------8<--------

You can define default implementations for PVFs.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Something good for .net developers jamesk ADO.NET 0 April 30th, 2008 12:02 PM
professional xml for .net developers code lkr9 All Other Wrox Books 1 March 27th, 2006 05:03 PM
professional xml for .net developers AlbertHu All Other Wrox Books 1 November 5th, 2004 11:09 AM
Visual C++.Net: A primer for C++ developers. Andy Bache All Other Wrox Books 0 October 29th, 2003 08:19 AM
Source code for the book "Visual C++.net: a primer Julie Lin .NET Web Services 0 September 29th, 2003 02:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.