what does this mean: virtual result

D

David

Hi, Buddy,

a newbie's question for you guys,

In C++, some functions have a return value type "result", what does
this mean, I searched on web, but no hint.
thanks a lot

David

***************************************
class MyClass
{
//database's own file descriptor
int db_fd;
//database header
DbHeader *db_hdr;
//memory pointer to the current opened Data Set
St_Layer *cdlayer;
//mmeory pointer to the data file of current Data Set
St_DataFile *cdfile;

public:
char *db_name;

public:

St_Db(const char *dname, Result& res, bool is_new = 0);
virtual ~St_Db();

//===
//=== Data layer related operations
//===

int getNLayers (void);
virtual Result openLayer (const char *name, St_Layer*& layer);
virtual Result closeLayer (LID lid);
virtual Result closeLayer (const char *name);
virtual St_DataFile* getDFile(const OID& oid);
virtual St_HeapFile* getHeap (LID lid);
virtual St_Layer* getLayer(LID lid);
.........
}
 
A

Allan Bruce

David said:
Hi, Buddy,

a newbie's question for you guys,

In C++, some functions have a return value type "result", what does
this mean, I searched on web, but no hint.
thanks a lot

David

***************************************
class MyClass
{
//database's own file descriptor
int db_fd;
//database header
DbHeader *db_hdr;
//memory pointer to the current opened Data Set
St_Layer *cdlayer;
//mmeory pointer to the data file of current Data Set
St_DataFile *cdfile;

public:
char *db_name;

public:

St_Db(const char *dname, Result& res, bool is_new = 0);
virtual ~St_Db();

//===
//=== Data layer related operations
//===

int getNLayers (void);
virtual Result openLayer (const char *name, St_Layer*& layer);
virtual Result closeLayer (LID lid);
virtual Result closeLayer (const char *name);
virtual St_DataFile* getDFile(const OID& oid);
virtual St_HeapFile* getHeap (LID lid);
virtual St_Layer* getLayer(LID lid);
........
}

virtual methods are used for dynamic binding or polymorphism, have a look at
google or you favourite C++ book for more information. As for the "Result"
part, as far as I can tell, this must be a typedef or define somewhere else
in the code.
Allan
 
J

JKop

David posted:
Hi, Buddy,

a newbie's question for you guys,

In C++, some functions have a return value type "result", what does
this mean, I searched on web, but no hint.
thanks a lot


That's not all of your code. At the beginning of that file you must have
something like:


#include <someheader.hpp>


And inside that header file there must be something like:


class Result ...

or

enum Result ...

or

union Result ...

or

struct Result ...

or

typedef ... Result


Or maybe even:

#define Result



For a list of the keywords in C++, go to msdn.microsoft.com and search for
"C++ keywords union enum struct static_cast return if for virtual". There,
you'll see that Result isn't a keyword!


-JKop
 
V

Victor Bazarov

David said:
Hi, Buddy,

a newbie's question for you guys,

In C++, some functions have a return value type "result", what does
this mean, I searched on web, but no hint.

It seems that somewhere outside the code fragment that you posted,
the 'Result' is defined as a type. It could be done using a typedef
or a #define or 'class' or 'struct'. Search in other modules that
complete the codebase you have. It can be a header file that came
with the library you're using.

thanks a lot

David

***************************************
class MyClass
{
//database's own file descriptor
int db_fd;
//database header
DbHeader *db_hdr;
//memory pointer to the current opened Data Set
St_Layer *cdlayer;
//mmeory pointer to the data file of current Data Set
St_DataFile *cdfile;

public:
char *db_name;

public:

St_Db(const char *dname, Result& res, bool is_new = 0);
virtual ~St_Db();

//===
//=== Data layer related operations
//===

int getNLayers (void);
virtual Result openLayer (const char *name, St_Layer*& layer);
virtual Result closeLayer (LID lid);
virtual Result closeLayer (const char *name);
virtual St_DataFile* getDFile(const OID& oid);
virtual St_HeapFile* getHeap (LID lid);
virtual St_Layer* getLayer(LID lid);
........
}

Victor
 
P

Prateek R Karandikar

Hi, Buddy,

a newbie's question for you guys,

In C++, some functions have a return value type "result", what does
this mean, I searched on web, but no hint.

It just means what is obvious: that the name of the return type is
"result". Nothing special about the name "result". Compilers don't
understand English, so it makes no difference whether you use a
meaningful name like "result" or a name like "foo_bar_nonsense_stuff".
thanks a lot

Welcome.

-- --
Abstraction is selective ignorance.
-Andrew Koenig
-- --
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top