what does this mean: virtual result

Discussion in 'C++' started by David, Jun 24, 2004.

  1. David

    David Guest

    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);
    .........
    }
     
    David, Jun 24, 2004
    #1
    1. Advertising

  2. David

    Allan Bruce Guest

    "David" <> wrote in message
    news:...
    > 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
     
    Allan Bruce, Jun 24, 2004
    #2
    1. Advertising

  3. David

    JKop Guest

    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
     
    JKop, Jun 24, 2004
    #3
  4. David wrote:
    > 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
     
    Victor Bazarov, Jun 24, 2004
    #4
  5. (David) wrote in message news:<>...
    > 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
    -- --
     
    Prateek R Karandikar, Jun 24, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pembed2003
    Replies:
    2
    Views:
    1,366
    Kench
    Jun 25, 2004
  2. Bill Zhao
    Replies:
    2
    Views:
    383
    David Hilsee
    Aug 12, 2004
  3. moralbarometer
    Replies:
    8
    Views:
    519
    moralbarometer
    Mar 5, 2007
  4. C Barrington-Leigh
    Replies:
    1
    Views:
    1,213
    Tim Leslie
    Sep 10, 2010
  5. Michael Tan
    Replies:
    32
    Views:
    1,005
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page