Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 이웃한 칸
- Python
- 프로그래머스
- SNS
- Project
- frontend
- 자바독학
- 사물인터넷
- 빅데이터
- java정리
- 주가예측
- 개발자
- Reflex
- 자바정리
- 코딩
- 자바
- 프로그래밍
- 개인프로젝트
- 모의 주식
- 풀스택프레임워크
- 코딩독학
- 백준
- backend
- 개발
- 코테
- 프로그램
- 코스닥
- java
- C++
- 코딩테스트
Archives
- Today
- Total
Creative Code
main.cpp(컴파일러가 자동생성하는 함수) 본문
※main.cpp파일
#include <iostream>
#include "empty.h"
int main() {
Empty e1; //컴파일러에서 디폴트 생성자와 소멸자가 자동으로 생성)(명시적인 생성자가 없을때 생성)
const Empty e2 = e1; //컴파일러에서 복사생성자를 자동으로 생성
e1 = e2;
Empty *p1 = &e1; // e1.operator&()
const Empty *p2 = &e2; // e2.operator&()
return 0;
}
※empty.h파일
#ifndef EMPTY_H
#define EMPTY_H
// 따로 만들지 않아도 컴파일러에서 자동으로 만들어주는 멤버함수
class Empty {
//Empty() { }; //클래스 안에서 함수를 정의할 수 있다 (inline 함수로 만들 때)
//~Empty() { };
//Empty(const Empty& rhs) {/* memberwise copy */ }; //각각의 멤버들을 치환하는 복사생성자
//Empty& operator=(const Empty& rhs) { /*memberwise copy */ }; //각각의 멤버들을 치환하는 연산함수
//Empty* operator&() {return this;} ;
//const Empty* operator&() const {return this;};
};
#endif
'C++ Programming' 카테고리의 다른 글
main.cpp(complex클래스 증감연산자) (0) | 2023.09.01 |
---|---|
main.cpp(employee클래스) (0) | 2023.09.01 |
main.cpp(string2) (0) | 2023.09.01 |
main.cpp(string) (0) | 2023.08.31 |
main.cpp(rational클래스 여러 연산자) (0) | 2023.08.31 |