일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- c언어
- c#
- C++
- 도커
- Flutter
- 유니티
- git
- 포인터
- Python
- gitlab
- 플러터
- Houdini
- Unity
- dart 언어
- c# 윈폼
- github
- C언어 포인터
- Data Structure
- vim
- c# 추상 클래스
- docker
- 깃
- c# winform
- 다트 언어
- Algorithm
- jupyter lab
- 구조체
- HTML
- jupyter
- C# delegate
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