473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

order of base class declaration

Can anyone shed light on why the following gives the compile time
error:

'entity *surface_entity::clone(void)' : overloaded member function not
found in 'surface_entity'

================================================== =======================
class entity {
public:
virtual entity* clone() const = 0;
};

class surface {
protected:
virtual void redo_caches() const {}
};

class surface_entity : public surface, public entity {
public:
surface_entity* clone() const { return new surface_entity(*this); }
private:
void redo_caches() const {}
};
================================================== =======================

Whereas either

[a] Making either "clone()" OR "redo_caches()" non-virtual

or

[b] Changing the order of base class declaration, i.e., "public
entity, public surface" instead of "public surface, public entity"

makes the error go away?
Thanks in advance,
Sandeep

p.s. the compiler is microsoft visual c++ 7
Jul 22 '05 #1
1 1197

"Sandeep Pulla" <bo******@hotmail.com> wrote in message news:b0**************************@posting.google.c om...
Can anyone shed light on why the following gives the compile time
error:

'entity *surface_entity::clone(void)' : overloaded member function not
found in 'surface_entity'
Most likely that your compiler doesn't implement covariant return types.
Try defining surface_entity::clone() to return entity*.

p.s. the compiler is microsoft visual c++ 7


Try asking in microsoft.public.vc.language. They're more familiar with VC++'s
bugs and limitations there.

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
3
by: crichmon | last post by:
Any general advice for dealing with circular dependencies? For example, I have a situation which, when simplified, is similar to: ///////////// // A.h class A { public: int x;
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
3
by: ashaniray | last post by:
Hi, The ISO-C++ spec says that the order of construction for C++ objects is: **************************************************************** .... Initialization shall proceed in the...
3
by: Jeff User | last post by:
Hello I am using C#, .net1.1 Vis Studio 2003 I am using homeBase.aspx.cs page as a base for several other aspx/aspx.cs web pages. The base page handles some operations that are common to all...
8
by: Jackson | last post by:
I want a class that will determine its base class by the argument passed in. What I am about to write _does_not_work_, but it shows what I am trying to do. class ABC(some_super): def...
4
by: Grizlyk | last post by:
Hello. Why were base class "typedefs" hidden by template<and explicit usage of them does not work too? Try open only one of the lines in the example below //using Tparent::Tptr; //typedef...
7
by: Daniel Jeffrey | last post by:
Hello, I am coming from Delphi and when I have a method in the inherited class, I call Inherited to call the base class method. This is handy cause you can control where and when these things...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.