E D R , A S I H C RSS

BackLinks search for "NonNegativeUPNumber"

BackLinks of NonNegativeUPNumber


Search BackLinks only
Display context of search results
Case-sensitive searching
  • MoreEffectiveC++/Techniques1of3
         class NonNegativeUPNumber:
         class NonNegativeUPNumber:
         자, 지금까지 다소 맹목적(?)으로 Heap영역에 객체 올리기에만 열중했다. 그럼 여기에서는 "on the heap"의 의미를 확실한 테스트로서 알아 보도록 하겠다. 앞서 써먹은 NonNegativeUPNumber를 non-heap 객체로 만드는건 뭐 틀리지 않은 것이다.
         NonNegativeUPNumber n; // fine
         이것이 허용된다는 것이다. 자, 그럼 지역 객체인 NonNegativeUPNumber의 n에서 UPNumber의 부분은 heap위에 있는 것이 아니다. 맞는가? 이 답변은 클래스의 설계(design)과 적용(implementation)에 기인해야 이해 할수 있을 것이다. 답을 찾아가 보자.UPNumber가 반드시 heap영역에 존재 해야 한다는 것에 관해 not okay를 던지면서 시작해 보자. 어떻게 우리는 이러한 제한 사항을 해결해야 하는 걸까?
         NonNegativeUPNumber *n1 = new NonNegativeUPNumber; // Heap영역
         NonNegativeUPNumber n2; // 비 Heap영역
         class NonNegativeUPNumber: // 이 클래스에서는 operator new에대한
         NonNegativeUPNumber n1; // 이상 없다.
         static NonNegativeUPNumber n2; // 역시 이상 없다.
         NonNegativeUPNumber *p = // 사역(private)인자인 opreator new가 불려서
          new NonNegativeUPNumber; // 에러가 발생한다.
         마지막 new를 쓴 부분에서는 NonNegativeUPNumber를 new로 생성할때 부모인 UPNumber부분을 생성할때 private로 제약이 발생되어서 에러가 발생하는 것이다.
Found 1 matching page out of 7544 total pages

You can also click here to search title.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
Processing time 0.0359 sec