-
Notifications
You must be signed in to change notification settings - Fork 1
0. Style Guide
Alec Graves edited this page May 17, 2017
·
1 revision
Component | Naming Convention |
---|---|
Class | ClassName |
Function | FunctionName |
Private variable | _variableName |
Public variable | VariableName |
Function variable | variableName |
Constant | CONSTANT_NAME |
Enum | EnumName |
Struct | StructName |
#include <string>
#include <iostream>
class GreetingClass
{
private:
const std::string WELCOME_STRING = "Welcome ";
std::string _firstName;
public:
std::string LastName;
void PrintWelcomeText()
{
auto welcomeText = WELCOME_STRING + _firstName;
if(!LastName.empty())
{
welcomeText += " " + LastName;
}
std::cout << welcomeText << std::endl;
}
GreetingClass(std::string firstName)
{
_firstName = firstName;
}
};
int main()
{
auto greetingObject = new GreetingClass("Syed");
greetingObject->LastName = "Ali";
greetingObject->PrintWelcomeText();
return 0;
}
output: Welcome Syed Ali