C++ Non-Static Member Functions

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • // Calling:

    • variable.member_function();
    • variable_pointer->member_function();
  • // Definition:

    • ret_type class_name::member_function() cv-qualifiers {
      • body;
    • }
  • // Prototype:

    • class class_name {
      • virt-specifier ret_type member_function() cv-qualifiers virt-specifier-seq;
      • // virt-specifier: "virtual", if applicable.
      • // cv-qualifiers: "const" and/or "volatile", if applicable.
      • // virt-specifier-seq: "override" and/or "final", if applicable.
    • }

Remarks

A non-static member function is a class/struct/union member function, which is called on a particular instance, and operates on said instance. Unlike static member functions, it cannot be called without specifying an instance.

For information on classes, structures, and unions, please see the parent topic.



Got any C++ Question?