Possible Duplicate:
What is the meaning of the term “free function” in C++?
I am not sure what a standalone function is.
Is it inside the class or same as normal function outside the main and class?
A standalone function is a function (a subprogram that returns a single value) that is stored in the database. Note: A standalone function that you create with the CREATE FUNCTION statement differs from a function that you declare and define in a PL/SQL block or package.
A stand-alone function is just a normal function that is not a member of any class and is in a global namespace. For example, this is a member function: class SomeClass { public: SomeClass add( SomeClass other ); }; SomeClass::add( SomeClass other ) { <...> }
There are two types of functions in C++: stand-alone functions and member functions.
A stand-alone function is just a normal function that is not a member of any class and is in a global namespace. For example, this is a member function:
class SomeClass
{
public:
SomeClass add( SomeClass other );
};
SomeClass::add( SomeClass other )
{
<...>
}
And this is a stand-alone one:
SomeClass add( SomeClass one, SomeClass two );
A stand-alone function is typically
class
or namespace
.strcpy()
)They should be used judiciously as too much of those will clutter the code.
A standalone function is one which doesn't depend on any visible state:
int max(int a, int b) { return a > b ? a : b; }
Here max
is a standalone function.
Standalone functions are stateless. In C++, they're referred to as free functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With