E D R , A S I H C RSS

Full text search for "UPInt"

UP Int


Search BackLinks only
Display context of search results
Case-sensitive searching
  • MoreEffectiveC++/Efficiency . . . . 24 matches
          class UPInt {
          UPInt();
          UPInt(int value);
          const UPInt operator+( const UPInt& lhs, const UPInt& rhs);
          UPInt upi1, upi2;
          UPInt upi3 = upi1 + upi2;
         뭐 놀랄건 없다. upi1과 upi2 모두 UPInt 객체이고, 둘다 UPInts를 위한 operator+에 의하여 더해진거다.
         이런 구문 역시 성공한다. 그것들은 정수 10을 UPInts로 임시객체가 생성으로 일련의 과정을 수행할수 있다.(Item 19참고)
         한걸음 뒤로 물러서서, 우리의 목표는 형변환 이 아닌 operator+를 UPInt와 int구분의 혼합으로 호출할수 있게 만들수 있음을 알수 있다. 암시적 형변환의 문제가 끝났것 같다. 그러면, 혼란스런 의미에 종지부를 찍어 보자. 여기 operator+의 수행을 성공시키는 또 다른 혼합된(mixed-type) 호출 방식이 있다. 그것은 처음 시도한 방법에서 암시적 형변환을 제거해 줄것이다. 만약 우리가 UPInt와 int를 합을 할수 있기를 원한다면 우리는 그걸 전부다 그렇게 그대로 만든다. 몇개의 함수를 각기 다른 인자 형(parameter type)으로 overload해서 선언해 버리는 것이다.
          const UPInt operator+(const UPInt& lhs, const UPInt& rhs);
          const UPInt operator+(const UPInt& lhs, const int rhs);
          const UPInt operator+(const int lhs, const UPInt& rhs);
          UPInt upi1, upi2;
          UPInt upi3 = upi1 + upi2;
          const UPInt operator+(const int lhs, const int rhs);
         자 이제 잘 생각해 보자. UPInt와 int의 형을 위해서 우리는 모든 가능한 인자들을 operator+에 구현하기를 원한다. 저 위의 예제의 세가지의 overloading은 잘 수행되지만 양 인자가 모두 int인 경우에는 되지 않느다. 우리는 이것마져 수행할수 있기를 바란다.
  • MoreEffectiveC++/Operator . . . . 13 matches
         class UPInt{ //무한 정수형
          UPInt& opertrator++(int); // prefix++
          const UPInt operator++(int); // postfix++
          UPInt& opertrator--(int); // prefix--
          const UPInt operator--(int); // postfix--
          UPInt& operator+=(int); // a += operator 는 UPInt와 ints 추가 위해
         UPInt i;
         UPInt& UPInt::operator++()
         const UPInt& UPInt::operator++(int)
          UPInt oldValue = *this; // fetch
          UPint i;
Found 2 matching pages out of 7540 total pages (5000 pages are searched)

You can also click here to search title.

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