Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A {
- public:
- float method1(float a) { does something with a}
- };
- class B {
- public:
- float method2(float a) { does something with a}
- float anothermethod2(float a) { does something with a}
- };
- class B {
- public:
- float method3(float a) { does something with a}
- };
- int main()
- {
- A a1;
- B b,b2;
- C c;
- std::vector< (what do i put in here?)> MethodsToCall;
- // put specific object's methods into the vector
- MethodsToCall.pushback( a1::method1 );
- MethodsToCall.pushback( b::method2 );
- MethodsToCall.pushback( c::method3 );
- MethodsToCall.pushback( b2::anothermethod2 );
- // call all the object's methods.
- for(F : MethodsToCall )
- {
- std::cout << F(3.5) << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement