Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

function in struct c++

struct foo {
  int bar;
  foo() : bar(3) {}   //look, a constructor
  int getBar() 
  { 
    return bar; 
  }
};

foo f;
int y = f.getBar(); // y is 3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #struct
ADD COMMENT
Topic
Name
4+8 =