1) It is well known that abstract classes are non-existent objects that provide only interfaces and do not provide implementations. But can abstract classes be used as a class pointer to the object of its subclasses?
classInterface { Public: Virtual voidFun () =0;};classImplement: PublicInterface { Public: voidFun () {cout<<"This is Implement object."<<Endl; }};int_tmain (intARGC, _tchar*argv[]) { Interface *obj = new Implement (); Obj-Fun (); return 0;}
Conclusion: Can. An abstract class cannot have its own class object, but you can define an abstract class pointer to an object whose child class.
2) Pointer to pointer two of the most common cases: ( the name of the array will degenerate into its first element of the pointer.) )
2.1 Array of pointers:
classShape { Public: voidTestFunc () {cout<<"Shape::testfunc ()"<<Endl; } //...}; Shape*picture[Ten];int_tmain (intARGC, _tchar*argv[]) {Shape**temp =Picture ; Shape*p = *temp; P-TestFunc (); return 0;}
2.2
voidScanto (Const Char**p,Charch) { while(**p && **p! =ch) { ++*p; }}int_tmain (intARGC, _tchar*argv[]) { CharS[] ="Hello, World"; Const Char*CP =s; Scanto (&CP,',');//move the pointer cp to the position where the first "," appearscout<<*cp<<Endl; return 0;}
3)
An analysis of the questions about C + +