에서 부울을 반환 기본 클래스에서 함수를 호출 할 수 있습니다 설정된 프로파일은 기본 클래스의 set_profile을 실행하고 다른 작업도 수행합니다.나는 나는 다음과 같은 기본 클래스 한 파생 클래스
방금 이렇게 작성할 수 있습니까?
bool node_layer_manager_with_rad_t::set_profile(void)
{
bool success;
node_layer_manager_t::set_profile();
try
{
string_t profile_tag = "logs/trx_dump/node:"+get_id();
dev_tx = profile->get_decendant(profile_tag.c_str());
cout<<"sarit id= "<< get_id()<<endl;
success = true;
}
catch(...)
{
cout<<"sarit profile error: "<<endl;
success = false;
}
return success; //**
}
이 ** 또는 내가 follwing을 reurn해야합니다 (그래서 실제로, 이것은 mcve 아닌 처음에는
return (success && node_layer_manager_t::set_profile());
이 C에 대한 질문입니다 ++ 또는 약 너의 특별한 디자인? 전자의 경우 언어 규칙을 위반하지 않는 프로그램 만 작성해야합니다. 이 두 가지 변종 모두 OK입니다. 후자의 경우 디자인을 완전히 이해하지 않고는 아무도 아이디어를 얻을 수 없습니다. 잠정적으로 두 번째 변종이 더 유망 해 보인다 (세터 내부의 인쇄는 의심스러워 보인다). –