Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ classes

Name: scd 2009-01-21 16:54

What benefit does it have, if I write the prototypes of the functions my class will have and then later write the actual functions?

Like for example:

class foo
{
   public:
   int value;
   void getValue();
};

void foo::getValue()
{
  return value;
}


Couldn't I simply define the function inside the class?
Like:

class foo
{
  public:
  int value;
  void getValue()
  {
     return value;
  }
};

Name: Anonymous 2009-01-22 1:34

>>11
I'm rusty on my sepples, so correct me if I'm wrong, but I meant that you could prototype them in the class so when you define the foo::getValue() you could use the bar::getValue() and when define the bar::getValue() you could use the foo::getValue() for compilers that don't look ahead.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List