function - C++ : How do I call private methods through public ones? -


i aware there similar questions 1 have been asked before, implementation different; cs student , our project given code snippet should not edit in way. allowed write function definitions prototypes in said snippet.

my problem , question regarding how should call private functions when code written way:

class classone {     private:     void methodone();      public:     void methodtwo(); }; 

so should able access methodone through methodtwo without writing { methodtwo();} beside methodone. me please?

you have class:

class classone {     private:     void methodone();      public:     void methodtwo(); }; 

implement functions of class:

void classone::methodone() { // <-- private    // other code }  void classone::methodtwo() { // <-- public    // other code    methodone();              // <-- private function called here } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -