Skip to content

Latest commit

 

History

History
47 lines (38 loc) · 2.74 KB

CppMemberVariable.md

File metadata and controls

47 lines (38 loc) · 2.74 KB

A member variable is a type of class member for an in-class variable. For example, a Person class might have a member variable to hold a Person his/her name.

#include <string>

struct Person
{
  std::string m_name;
  //Other member variables
};

int main()
{
  Person p;
  p.m_name = "John Doe";
}

LocalVersusGlobal is a simple benchmark that tests the speed of local versus member variables versus global variables.