March 9, 201016 yr comment_1020727 nk minta tolong terangkan mcm mane nk gune accesor untuk access data private dlm class tue conth:- Class X{ private: int w; int u; public: print()const; }; mcm nk print out data private tue dlm function print()const tue? Report
March 14, 201016 yr comment_1021521 accessor nie bermaksud apabila sesuatu "member function" nie yg dpt value dr "class memmber" tetapi nilainye x berubah... 2 la accessor.. contoh:- [code] class rectangle { private: double width; double length; public: void setWidth(double); void setLength(double); double getWidth() const; double getLength() const; double getArea() const; }; [/code] "member function" getlength dan getWidth 2 la accessors.. kalau nak print out plak... [code] double rectangle::getWidth() const { return width; } [/code] make sure value da pass dlm function main.. Report
March 14, 201016 yr Author comment_1021550 kalau kt public tue ade function void print()const...mcm mane nk gune accessor tue dlm function print tue? Report
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.