class A { public: virtual int Proc() = 0; }; class B : public A { public: int Proc() { return 1; } }; class C : public A { public: int Proc() { return 2; } }; class D : public C, public B { };
int main() { D d; B* b = &d; C* c = &d; std::cout << b->Proc() << std::endl; std::cout << c->Proc() << std::endl; }
class A_base { }; class A :virtual public A_base { public: virtual int Proc() = 0; }; class B :virtual public A_base { }; class C :public A { public: int Proc(){ return 0; } }; class D :public C, public B { };
D d;
B と C に共通だった部分は、 別クラスにして一応解決致しますた。 レス下さった方々どうもありがとう。
このほうがわかりやすくないか? int ***malloc3D(int x, int y, int z) { int ***p = malloc(sizeof(int**) * x); int i, j; for (i = 0; i < x; ++i) { p[i] = malloc(sizeof(int*) * y); for (j = 0; j < y; ++j) p[i][j] = malloc(sizeof(int) * z); } return p; }
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function.
License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this documentation and/or software. */
void String::Replaces(char StrA[],char StrB[]) { int At = Search(StrA); printf(""); //← コイツ。どこに置こうが結果は同じ。 for( int i = 0 ; i < Haw_meny(StrA) ; i++ ) Insertion(StrB,Search(StrA,i));
より、詳細で描画いたしますと(・_・) //A.h #include "B.h" class A { B b;}; //B.h #include "B.h" class B { A a }; このよーなばわいでございます!インクルードガードがついているものと考えて下さい! (^^; よろしくお願い致しますm(_ _)m