1.4.2. Functions - class members

Lecture



Component function must be described in the class body. When defining classes, their component functions can be specified as inline . In addition to the explicit use of the word inline, the following conventions are used for this. If the definition of the function is completely located in the body of the class, then this function is considered to be an inline by default. If only the function prototype is placed in the class body, and its definition is outside the class, then in order for the function to be substitutable, it must be explicitly specified by the word inline. With an external definition of a function, the prototype of the function is placed in the class body.

type function_name (specification_and_initialization_parameters);

Outside the body of a class, the function is defined as

type class_name:: function_name (specification of formal_parameters)

{body_function}


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

C ++ (C plus plus)

Terms: C ++ (C plus plus)