When defining a function in the class body, are you always declaring it or how would you say? Here is an example:
class ss
{
ss() {}
};
Are we then declaring the constructor, defining the constructor, or declaring AND defining the constructor. What could you say about this?
You're both declaring and defining the constructor.
A declaration only would look like:
class ss
{
ss();
}
You can seperate the definition and declaration outside the class to show the obvious difference between the two:
class ss
{
ss(); //declaration
}
ss::ss() {} // definition
A definition is by definition a declaration too.
A declaration is only the signature of a function, a definition includes the actual function body.
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