当前位置: 首页>>代码示例>>C++>>正文


C++ B类代码示例

本文整理汇总了C++中B的典型用法代码示例。如果您正苦于以下问题:C++ B类的具体用法?C++ B怎么用?C++ B使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了B类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: g

void g()
{
    const B b;

    int *pi;
    pi = b.f(0);
}
开发者ID:bsc-pm,项目名称:mcxx,代码行数:7,代码来源:success_446.cpp

示例2: h

void h()
{
    using B::f;
    using C::f;
    f('h');
    f(1);         // { dg-error "ambiguous" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 22 }
    void f(int);  // { dg-error "previous using declaration" }
}
开发者ID:kostyll,项目名称:gccpy,代码行数:9,代码来源:using9.C

示例3: main

int main()
{
  B b1;
  const B b2 = B();

  b1.f ();
  b2.g ();
  b2.h ();
  b1.i ();
}
开发者ID:0day-ci,项目名称:gcc,代码行数:10,代码来源:using1.C

示例4: main

int main()
{
	

	std::vector<A> veca(1);

	std::vector<B> vecb(1);
	std::cout << veca[0].geta()<<" "<<vecb[0].geta() << " " << vecb[0].getb() << std::endl;

    A a;
	B b;

	std::cout << a.geta()<<" "<<b.geta() << " "<<b.getb() << std::endl;
	std::cout << g_a.geta()<<" "<<g_b.geta() <<" "<<g_b.getb()<<std::endl;
 	return 0;
}
开发者ID:CCJY,项目名称:coliru,代码行数:16,代码来源:main.cpp

示例5: main

int main() {
    using B::g;
    g('a');             // calls B::g(char)
    struct g g1;        // g1 has class type B::g
    B::h( &g1 );
    if( g1.g != -34 ) _fail;
    _PASS;
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:8,代码来源:ns29.c

示例6: doIt

void A::doIt()
{
    cout << "A::doIt" << endl;
    if (aB)
    {
        aB->deleteTheA();
    }
    cout << "exit: A::doIt" << endl;
}
开发者ID:sdumi,项目名称:prg,代码行数:9,代码来源:pointers.cpp

示例7: main

int main()
{
	const B b1;
	assert(b1.func() == false);
}
开发者ID:AnnaTrost,项目名称:cbmc,代码行数:5,代码来源:main.cpp

示例8: setBValue

 //
 // the following two functions access
 // private member functions of class B
 // and they should not be able to do so
 //
 virtual void setBValue(int i) 
   { if (bobject) bobject->Number(i); }// ERROR - .*
开发者ID:akbertram,项目名称:egcs-jvm,代码行数:7,代码来源:visibility7.C

示例9: set_bits_iter

 explicit set_bits_iter(B const& b) : b(&b),i(b.find_first()) {}
开发者ID:fullstackenviormentss,项目名称:sbmt,代码行数:1,代码来源:bitset.hpp

示例10: getBValue

 virtual int getBValue()
   { if (bobject) { return bobject->Number(); } return 0; }// ERROR - .*
开发者ID:akbertram,项目名称:egcs-jvm,代码行数:2,代码来源:visibility7.C

示例11: A

namespace InhCtor {
  struct A {
    A(int);
  protected:
    int T();
  };
  typedef A T;
  struct B : A {
    // This is a using-declaration for 'int A::T()' in C++98, but is an
    // inheriting constructor declaration in C++11.
    using InhCtor::T::T;
  };
#if __cplusplus < 201103L
  B b(123);      // expected-error {{no matching constructor}}
                 // [email protected] 2{{candidate constructor}}
  int n = b.T(); // ok, accessible
#else
  B b(123);      // ok, inheriting constructor
  int n = b.T(); // expected-error {{'T' is a protected member of 'InhCtor::A'}}
                 // [email protected] {{declared protected here}}

  // FIXME: EDG and GCC reject this too, but it's not clear why it would be
  // ill-formed.
  template<typename T>
  struct S : T {
    struct U : S { // expected-note 6{{candidate}}
      using S::S;
    };
    using T::T;
  };
  S<A>::U ua(0); // expected-error {{no match}}
  S<B>::U ub(0); // expected-error {{no match}}

  template<typename T>
  struct X : T {
    using T::Z::U::U;
  };
  template<typename T>
  struct X2 : T {
    using T::Z::template V<int>::V;
  };
  struct Y {
    struct Z {
      typedef Y U;
      template<typename T> using V = Y;
    };
    Y(int);
  };
  X<Y> xy(0);

  namespace Repeat {
    struct A {
      struct T {
        T(int);
      };
    };
    struct Z : A {
      using A::A::A;
    };
    template<typename T>
    struct ZT : T::T {
      using T::T::T;
    };
  }

  namespace NS {
    struct NS {};
  }
  struct DerivedFromNS : NS::NS {
    // No special case unless the NNS names a class.
    using InhCtor::NS::NS; // expected-error {{using declaration in class refers into 'InhCtor::NS::', which is not a class}}

  };

  // FIXME: Consider reusing the same diagnostic between dependent and non-dependent contexts
  typedef int I;
  struct UsingInt {
    using I::I; // expected-error {{'I' (aka 'int') is not a class, namespace, or enumeration}}
  };
  template<typename T> struct UsingIntTemplate {
    using T::T; // expected-error {{type 'int' cannot be used prior to '::' because it has no members}}
  };
  UsingIntTemplate<int> uit; // expected-note {{here}}
#endif
}
开发者ID:efcs,项目名称:clang,代码行数:85,代码来源:p2.cpp

示例12: data

 /// Access a non-zero element
 inline DataType& at(int k) {
   try {
     if (k<0) k+=nnz();
     return data().at(k);
   } catch(std::out_of_range& /* unnamed */) {
     std::stringstream ss;
     ss << "Out of range error in Matrix<>::at: " << k << " not in range [0, " << nnz() << ")";
     throw CasadiException(ss.str());
   }
 }
开发者ID:BrechtBa,项目名称:casadi,代码行数:11,代码来源:matrix.hpp

示例13:

int
main()
   {
      abc = 0xcafe0210;
#if 1
      char  x = 0xff;
      short y = 0xcafe;
      A b;
      b.x = 0xcafe0110;
      b.y = 0xcafe0111;
      b.foo();

      D d;
      d.foo();
      d.x = 0xcafe0112;
#endif

      return 0;
   }
开发者ID:8l,项目名称:rose,代码行数:19,代码来源:testProgram_1.C

示例14: test

void A::test()
{
	if (b->fun_use_thread() == 0)
	{
		while(global->per < 100)
		{									
			key = getch();				
			if ( (dem < 100) && (key != '\n'))
			{													
				s[dem] = key;
				s[dem + 1] = '\0';		
				dem ++;				
			}
		}
	}else
	{
		printf("Can not creat thread\n");
	}
}
开发者ID:dangvanuy,项目名称:CLibrary,代码行数:19,代码来源:main_test.cpp

示例15: at

 typename base::Field at(typename base::Coord x) {
   return left.at(x) + right.at(x);
 }
开发者ID:ReiMatsuzaki,项目名称:l2func,代码行数:3,代码来源:linspace.hpp


注:本文中的B类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。