Non-Static Member Functions

Download c++ eBook

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.

Related Examples

Stats

39 Contributors: 2
Wednesday, October 19, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook