일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Houdini
- 플러터
- C++
- Data Structure
- Algorithm
- Flutter
- git
- Unity
- c# winform
- c# 추상 클래스
- C# delegate
- github
- 유니티
- Python
- 도커
- 포인터
- c#
- 다트 언어
- vim
- c언어
- 구조체
- HTML
- docker
- jupyter
- jupyter lab
- gitlab
- C언어 포인터
- dart 언어
- 깃
- c# 윈폼
Archives
- Today
- Total
목록정적 멤버 함수에서 객체 생성 (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