C++함수 반환 값 을 대상 으로 할 때 구조 분석 함수 의 실행 디 테 일
#include<iostream>
class TestConstructor
{
public:
TestConstructor()
{
std::cout<<"TestConstructor()"<<std::endl;
}
~TestConstructor()
{
std::cout<<"~TestConstructor()"<<std::endl;
}
TestConstructor(const TestConstructor& testObj)
{
std::cout<<"TestConstructor(const TestConstructor&)"<<std::endl;
}
TestConstructor& operator = (const TestConstructor& testObj)
{
std::cout<<"TestConstructor& operator = (const TestConstructor& testObj)"<<std::endl;
return *this;
}
};
TestConstructor testFunc()
{
TestConstructor testInFunc; //3、 TestConstructor() testInFunc
return testInFunc; //4、 TestConstructor(const TestConstructor&)
//5、 , testInFunc
}
int main()
{
TestConstructor test; //1、 TestConstructor() test
test = testFunc(); //2、 testFunc() //6、 test //7、 ,
return 0; //8、 , test
}
출력 보기:주석 이 있 고 출력 이 있 습 니 다.세부 사항 을 한눈 에 알 수 있 겠 지
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
구조 함수를 빌려 비원형을 계승하다Object {tag: Array[3]} tag: Array[3] 0: "js" 1: "html" 2: "aa" length: 3 __proto__: Array[0] __proto__: Article construc...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.