| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 깃
- c# 윈폼
- Houdini
- jupyter lab
- 포인터
- Python
- Algorithm
- C언어 포인터
- git
- C# delegate
- 구조체
- Flutter
- c#
- 다트 언어
- Data Structure
- gitlab
- c언어
- Unity
- 플러터
- c# 추상 클래스
- vim
- docker
- c# winform
- C++
- dart 언어
- HTML
- 유니티
- jupyter
- github
- 도커
Archives
- Today
- Total
목록c++ static member function (1)
nomad-programmer
[Programming/C++] 정적 멤버 함수에서 객체 생성
다음 예제에서 유심히 봐야할 것은 생성자가 private으로 되어 있다는 점이다. 즉, 클래스의 외부에서 객체 생성하는 것은 불가능하다. 하지만 멤버라면 가능하다. 그래서 정적 멤버 함수에서 객체를 동적으로 생성해서 그 주소를 반환하게 만들었다. #include #include using namespace std; class Student{ public: string name; int sNo; void Print(); private: Student(const string& name_arg, int stdNumber); public: static int studentNumber; static Student* CreateStudent(const string& name_arg); }; int Student::..
Programming/C++
2023. 1. 17. 01:56