私はFormat()を使用する必要のあるプログラムを持っています。文字列リテラルとintをCString変数に結合する関数。私はこれを行うにはいくつかの異なる方法を試してみましたが、それらのコードはここにある: // declare variables used
CString _CString;
int _int;
// try to use format function with s
を階層。 例:ただし #include <iostream>
#include <typeinfo>
using namespace std;
class Shape { public: virtual ~Shape() {}; };
class Circle : public Shape {};
class Square : public Shape {};
class Othe
次の構文は何を意味しますか? typedef void* hMyClass; //typedef as a handle or reference
hMyClass f = &something;
const MyClass& foo = static_cast<MyClass&>(*f);
foo.bar();
私はあるクラス(B)が常に第2のクラス(D)に派生することを知っているクラス階層を持っています。 Bのコンストラクタでは、構築全体が完了する前に誰もそれを使用しようとすることがないと確信すれば、thisポインタをD *に静的にキャストすることは安全ですか?私の場合、オブジェクトへの参照をさらに別のクラス(A)に渡したいと思います。 struct A
{
D & d_;
A(
static_castと同等のものはboost::shared_ptrとなりますか?言い換えれば 、どのように私はshared_ptrを使用する場合は、以下の Base* b = new Derived();
Derived* d = static_cast<Derived*>(b);
を書き換えなければならないのですか? boost::shared_ptr<Base> b(new Deri