Can I convert int to CString in an initialization list?
An abstract base class constructor is declared as
Base::Base(CString name);
The derived class constructor takes an integer as its parameter. This needs to be converted to, e.g., "Node 15" if the integer is 15, and used in the base class constructor.
In the base class you can only set the name in the constructor (unless I modify it). So I believe I have to use an initialization list to do this - I can't call the base class constructor from within the derived class constructor. But I can't see how to do this.
Derived::Derived(int nodeNum) : Base(?????) { }
I need something like
CString name;
name.Format("Node %d", nodeNum);
in there somewhere, but I can't for the life of me see how to do it. Sorry if this is an obvious question. I'm very familiar with C, but new to C++.