Constructors & Destructors
C
// Not Available
C++ (Cpp)
// Header File (MyClass.h or MyClass.hpp)
#pragma once
class MyClass
{
// Simplified Example
// ------------------------------------
// Constructor
// ------------------------------------
// The constructor has the same name as the class
// Can be omitted if you have no code to put here.
MyClass();
// You can have more than one
MyClass(int value);
MyClass(int value, float otherValue);
MyClass(char letter);
//and so on
// You can add the "explicit" keyword to avoid implicit conversion
explicit MyClass(int value);
explicit MyClass(int value, float otherValue);
explicit MyClass(char letter);
// You can also "delete" a specific constructor to remove its use
MyClass() = delete; // this constructor wont be available
};
// Header File (MyClass.h or MyClass.hpp)
#pragma once
class MyClass
{
// Simplified Example
// ------------------------------------
// Member Initializer / Member Initializer Lists
// ------------------------------------
};
// Header File (MyClass.h or MyClass.hpp)
#pragma once
class MyClass
{
// Simplified Example
// ------------------------------------
// Copy Constructor
// ------------------------------------
};
// Header File (MyClass.h or MyClass.hpp)
#pragma once
class MyClass
{
// Simplified Example
// ------------------------------------
// Move Constructor
// ------------------------------------
};
// Header File (MyClass.h or MyClass.hpp)
#pragma once
class MyClass
{
// Simplified Example
// ------------------------------------
// Desconstructor
// ------------------------------------
};
C# (Csharp)
// TODO
Java
// TODO
Rust
// TODO
Go
// TODO
Javascript
// TODO
Typescript
// TODO
Python
# TODO