class - Function overloading in namespace in c++ -


i need in implementing below task. want have namespace's same named classes rhs inherited library class function, same named function rhsvalue inside rhs classes different implementation in each namespace. class function doesnt have function named rhsvalue in implementation.

namespace s50{                  // mother namesapce in want implement tasks  class coeff: public function { // function class library public: virtual double value(); virtual void value_list(); }; }  namespace charge{ class rhs: public funtion { virtual double rhsvalue (); // function class not have function named rhsvalue() }; }  namespace s16{ class rhs: public function { virtual double rhsvalue(); // same named function in other namespace other implementation }; } 

it seems you've got want... mean described.

some comments:

1) don't need rhsvalue defined in function class, if it's not cannot call rhsvalue funciton using pointer function, eg.

function* function = new charge::rhs(); function->rhsvalue(); // error 

2) coeff class for? haven't mentioned in description

3) if need different implementations put this:

namespace charge{     class rhs: public funtion {     virtual double rhsvalue () { std::cout << "from charge"<< std::endl; }     }; } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -