Created
December 24, 2022 03:41
-
-
Save loneshark99/e6698625161b178f39e6be10a31f341b to your computer and use it in GitHub Desktop.
C++ Member Initializer List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Vector3.hpp" | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
Vector3 test; | |
cout << "X=" << test.x << " Y=" << test.y << " Z=" << test.z << endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Vector3.hpp" | |
Vector3::Vector3() : x(1.0f), y(2.0f), z(3.0f) | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef VECTOR3_HPP | |
#define VECTOR3_HPP | |
class Vector3 | |
{ | |
public: | |
float x,y,z; | |
Vector3(); | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment