本文整理汇总了C++中Foo::func6方法的典型用法代码示例。如果您正苦于以下问题:C++ Foo::func6方法的具体用法?C++ Foo::func6怎么用?C++ Foo::func6使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foo
的用法示例。
在下文中一共展示了Foo::func6方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: produce
void produce()
{
Foo * foo = new Foo;
int I=0;
int * PI;
int const * CPI;
foo->func1(i_);
foo->func1(ci_);
foo->func1(ir_);
foo->func1(icr_);
foo->func1(I);
foo->func2(i_);
foo->func2(ir_);
foo->func2(I);
foo->func6(i_);
foo->func6(ir_);
foo->func6(I);
foo->nonConstFunc();
foo_.nonConstFunc(); //should fail member data (object) call non const functions
foo_.constFunc(); //OK because const won't modify self
method1(i_);
method1(I);
modifyStatic(I);
modifyMember();
indirectModifyMember();
recursiveCaller(1);
PI=foo_.nonConstAccess(); //should fail returns pointer to member data that is non const qualified
CPI=foo_.constAccess(); // OK because returns pointer to member data that is const qualified
if (*PI==*CPI) I++;
}
示例2: method3
void method3() const
{
Foo foo;
int I=0;
Bar bar;
foo.func1(i_);
foo.func1(ci_);
foo.func1(ir_);
foo.func1(icr_);
foo.func1(I);
foo.func2(ir_);
foo.func2(I);
foo.func6(i_);
foo.func6(ir_);
foo.func6(I);
foo_.nonConstRefAccess();
foo_.constRefAccess();
// foo_.nonConstFunc();
foo_.nonConstAccess();
foo_.constAccess();
if (i_) method2(i_);
bar.produce();
// will produce a warning only by ConstCastAwayChecker
int & ir = (int &) (icr_);
int & cir = const_cast<int &>(icr_);
int * ip = (int *) (icp_);
int * cip = const_cast<int *>(icp_);
// must not produce a warning
int const& ira = (int const&)(icr_);
// will produce a warning by StaticLocalChecker
static int evilStaticLocal = 0;
static int & intRef = evilStaticLocal;
static int * intPtr = & evilStaticLocal;
// no warnings here
static const int c_evilStaticLocal = 0;
static int const& c_intRef = evilStaticLocal;
static int const* c_intPtr = &evilStaticLocal;
static const int * c_intPtr_equivalent = &evilStaticLocal;
static int const* const* c_intPtrPtr = &( c_intPtr);
g_static=23;
si_=23;
modifyStatic(I);
}