C++.Coding.Standards.1918.Rules.Guidelines [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

C++.Coding.Standards.1918.Rules.Guidelines [Electronic resources] - نسخه متنی

Herb Sutter, Andrei Alexandrescu

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Examples


Example 1: Operators.
The streaming

operator<< and

operator>> for objects of some class type

X are perhaps the most compelling examples of functions that are clearly part of the interface of the class

X , but which are always nonmember functions (this is of necessity, because the left-hand argument is a stream, not an

X ). The same argument applies to other nonmember operators on

X objects. Make sure that your operators appear in the same namespace as the class on which they operate. When you have the option, prefer making operators and all other functions nonmember nonfriends (see Item 44).

Example 2: Other functions.
If the author of

X supplies named helper functions that take

X objects, they should be supplied in the same namespace, otherwise calling code that uses

X objects will not be able to use the named functions without explicit qualification or a

using statement.


/ 521