From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 26 19:51:05 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DE9C716A4CE for ; Mon, 26 Jul 2004 19:51:05 +0000 (GMT) Received: from mailserv1.neuroflux.com (mailserv1.neuroflux.com [204.228.228.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 723DB43D1D for ; Mon, 26 Jul 2004 19:51:05 +0000 (GMT) (envelope-from ryans@gamersimpact.com) Received: (qmail 95926 invoked by uid 89); 26 Jul 2004 19:55:32 -0000 Received: from unknown (HELO www2.neuroflux.com) (127.0.0.1) by localhost with SMTP; 26 Jul 2004 19:55:32 -0000 Received: from 208.4.77.15 (SquirrelMail authenticated user ryans@gamersimpact.com) by www2.neuroflux.com with HTTP; Mon, 26 Jul 2004 13:55:32 -0600 (MDT) Message-ID: <49805.208.4.77.15.1090871732.squirrel@www2.neuroflux.com> Date: Mon, 26 Jul 2004 13:55:32 -0600 (MDT) From: "Ryan Sommers" To: hackers@freebsd.org User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal Subject: Question for C++ Experts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2004 19:51:06 -0000 Pardon my sending this to a FreeBSD list. After searching I couldn't find any other good mailings lists devoted to C++ and this was the only source I knew of that might have someone that could answer my question. I'm working on a project that uses about 3 different coordinate systems and all are closely related. The only differences are in the bounds and representation. As a way to represent all of these I came up with a base class representing the general case and then derived classes for all the specific systems. As part of my class I use constructors that take the coordinates as inputs. As a means of bounds checking I declared a pure virtual function that checks whether it is within the valid bounds of the derived class. The problem I am running into is that it seems to be illegal to call a pure virtual function from an abstract base contructor. I'm not sure exactly why this would be considered an eror; from what I can think of the dynamic binding would be no different than for a binding in a non-constructor function. Anyone know of any tricks to get around this? Or other methods that might allow me to do the correct bounds checking in the constructor as opposed to delaying it to a second 'init' type call? Ryan Sommers ryans@gamersimpact.com