View Single Post
Old 02-26-2017, 02:26 AM   #1
Anomaly
Human being with feelings
 
Anomaly's Avatar
 
Join Date: Sep 2007
Posts: 642
Default Overriding a method..?

Greetings,

I'm just learning c++, so I hope my question is not ridiculous?
My dilemma is that I'd like to be able to programmatically override a method INSIDE a single class. Is this even possible?

Here is a pseudo-code example:
Code:
Class Processor {

	void SetUpProcessor(int choice) {
		if (choice == 0) {
			howToProcess = DoItThisWay();
		}
		if (choice == 1) {
			howToProcess = DoItThatWay();
		}
	}

	double DoItThisWay(double input) {
		...blaa blaa
	}

	double DoItThatWay(double input) {
		...blaa blaa
	}

	double Process(double input) {
		return howToProcess(input);
	}

}
Thanks for your patience
__________________
___________________________
Sonic Anomaly | free JSFX & VST Plugins
Anomaly is offline   Reply With Quote