Monday, June 27, 2011

(PT) select derived class file global variable by base class virtual function

 

This is a common problem I am facing. I am intended to write a derived class for an existing code. Let me provide the code snippet (just example):
Base_class_file:
const int addr=0xA;
Base_class::Read() { return *addr; }
Please note, the addr variable is a global variable in base class file. Now, I am writing the derived class because to change some functionality and also to change the addr. I would like to re-use the Read() method, and just mention the new addr(let's say 0xB) in the derived class file. Since this variable is a global variable, how do I mention to the base class Read() method to use the addr=0xB than the 0xA ??
Your help is greatly appreciated.

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
To unsubscribe : programmers-town-unsubscribe@yahoogroups.com

.

__,_._,___

No comments: