I am very new to programming & amp; A book has been read in a program which is reading me. I get a compilation error in it.
The error says, "variable-size object 'ptrFunc' can not be started '. (This indicates the end of the array)
Please advise, in this Thanks in advance. Thanks
# include & lt; iostream & gt; Using Namespace STD; Class Cadog {Public: Zero Speaking () Const {cout & lt; & Lt; "\ nWoof !!";} Zero Step () const {cout & lt; & lt; "\ nGoing for the heel ...";} Zero Food () const {cout & lt; & Lt; "\ nGubbing food ...";} zero germination () Const {cout & lt; "\ nGrrrgh ...";} zero-cancer () const {cout & lt; "\ nWinding sound ...";} zero rollover () const {Cout & lt; & lt; "\ n Rolling over ...";} Zero pledded () const {cout * ptrFunc [selection-1]) (); Delete PtrDog; }} Cout & lt; & Lt; Endl; Return 0; } Int printMenu () {int sel = 0; The court's & lt; & Lt; "\ N \ t \ tMenu"; Cout & lt; & Lt; "\ N \ n1. Eat"; Cout & lt; & Lt; "\ N 2. Growl"; Cout & lt; & Lt; "Move \ n3." Cout & lt; & Lt; "\ N 4. Play dead"; Cout & lt; & Lt; "\ N 5. Rollover"; Cout & lt; & Lt; "Say \ n6." Cout & lt; & Lt; "\ N7. Whipper"; Cout & lt; & Lt; "\ N8. Skip"; Cout & lt; & Lt; "\ N \ n \ tElect your selection:"; CIN & gt; & Gt; Sel; Return sel; }
zero (cDog :: * ptrFunc [noOfFunc]) () Const = {
NoofFunk
is not currently inaccessible; You will need to declare it as a const int
so that it can be used as an array size (the size of an array is known in time compilation).
However, when you declare an array like an initial like you do, you can leave the shape; The compiler will determine it by the number of elements in the initiator. You can just say:
void (cDog :: * ptrFunc []) () const = {
Comments
Post a Comment