Methods

Lesson 14
Author : Afrixi
Last Updated : November, 2017


C++ - Programming Language
This course covers the basics of programming in C++. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

int main(){ return 0; }

void sayHi(){ cout << "Hello" << endl; }

int main(){ sayHi(); return 0; }

void sayHi(string name){ cout << "Hello " + name << endl; }

A parameter is a special variable that a Method will use to perform it's task in a way that is more specific to the needs of the caller. An argument is the value the caller gives to the Method which will get stored inside the parameter variable.

int main(){ sayHi("Mike", 24); return 0; }

void sayHi(string name, int age){ cout << "Hello " + name + " you are " + age << endl; }