Is it possible to declare method pointers of abstract classes?

and then assign the value of those pointers with the address of the implemented methods of derived classes? Is it possible?
yes
abstract base class BaseClass

//CODE//

TestClass ** testclasses; //dubbelpointers to the abstract base class


testclasses = new TestClass*[SIZE];



testclasses[0] = new "derived class"();




:P

abstract base class BaseClass

//CODE//

TestClass ** testclasses; //dubbelpointers to the abstract base class


testclasses = new TestClass*[SIZE];



testclasses[0] = new "derived class"();



err I don't think I was referring to this, I'm referring to declaring method pointers of abstract classes(the method in the abstract class is pure virtual) and then assigning those pointers the addresses of methods of derived classes
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Base{
public:
	virtual void foo(void) = 0;
};

class Deriv : public Base{
public:
	virtual void foo(void){
		cout << "hello world" << endl;
	}
};
typedef void (Base::*ptr) (void);

int main() {
	ptr pointer = &Base::foo;
	Deriv d;
	(d.*pointer)();
	return 0;
}
ok thanks
Topic archived. No new replies allowed.