Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
C.P.Rajesh17-Apr-08 21:33
C.P.Rajesh17-Apr-08 21:33 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
Naveen17-Apr-08 21:46
Naveen17-Apr-08 21:46 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
CPallini17-Apr-08 21:48
mveCPallini17-Apr-08 21:48 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
Naveen17-Apr-08 21:55
Naveen17-Apr-08 21:55 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
CPallini17-Apr-08 22:48
mveCPallini17-Apr-08 22:48 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
Naveen17-Apr-08 22:58
Naveen17-Apr-08 22:58 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
CPallini17-Apr-08 21:45
mveCPallini17-Apr-08 21:45 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' [modified] Pin
C.P.Rajesh17-Apr-08 21:55
C.P.Rajesh17-Apr-08 21:55 
I didn't understand your reply. My requirement is i need a linked list which stores multiple type of objects in a single list. So i have a data class (a template class) like below

template <class T> class data : public base
{
T myData;

public:
T&amp; getData () {return myData;}
bool putData (const T& aData) {myData = aData; return true;}

// Overloaded operator which takes base class pointer
data<T>* operator= (base* aBase)
{
return (data<T>*)aBase;
}

};

Each node has a base class pointer which stores derived class object. So while retrieving the data from linked list i use this overloaded operator. The advantage is if i use data<wrongdatatype> on left handside of = operation it will give compilation error.

If you have any other suggestion for the problem i will be happy to hear.

modified on Friday, April 18, 2008 4:02 AM

<div class="ForumMod">modified on Friday, April 18, 2008 4:03 AM</div>
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
CPallini17-Apr-08 22:55
mveCPallini17-Apr-08 22:55 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
C.P.Rajesh17-Apr-08 23:24
C.P.Rajesh17-Apr-08 23:24 
GeneralRe: error C2440: 'initializing' : cannot convert from 'class base *' to 'class Derived *' Pin
jhwurmbach18-Apr-08 2:26
jhwurmbach18-Apr-08 2:26 
QuestionHow to Change the Font Dynamically on button control Pin
phanindra varma17-Apr-08 20:39
phanindra varma17-Apr-08 20:39 
AnswerRe: How to Change the Font Dynamically on button control Pin
Hamid_RT17-Apr-08 21:00
Hamid_RT17-Apr-08 21:00 
AnswerRe: How to Change the Font Dynamically on button control Pin
softwero18-Apr-08 12:46
softwero18-Apr-08 12:46 
GeneralRe: How to Change the Font Dynamically on button control Pin
phanindra varma18-Apr-08 22:23
phanindra varma18-Apr-08 22:23 
GeneralRe: How to Change the Font Dynamically on button control Pin
softwero22-Apr-08 8:57
softwero22-Apr-08 8:57 
GeneralCombo Box issue Pin
Chandrasekharan P17-Apr-08 20:12
Chandrasekharan P17-Apr-08 20:12 
GeneralRe: Combo Box issue Pin
Hamid_RT17-Apr-08 20:33
Hamid_RT17-Apr-08 20:33 
GeneralRe: Combo Box issue Pin
Iain Clarke, Warrior Programmer17-Apr-08 22:57
Iain Clarke, Warrior Programmer17-Apr-08 22:57 
Questionhow can i set the menu position . Pin
vasu_sri17-Apr-08 19:43
vasu_sri17-Apr-08 19:43 
GeneralSaveDC returning 0 Pin
Super Hornet17-Apr-08 19:43
Super Hornet17-Apr-08 19:43 
GeneralRe: SaveDC returning 0 Pin
Hamid_RT17-Apr-08 20:31
Hamid_RT17-Apr-08 20:31 
GeneralRe: SaveDC returning 0 Pin
Super Hornet17-Apr-08 20:34
Super Hornet17-Apr-08 20:34 
GeneralRe: SaveDC returning 0 Pin
Hamid_RT17-Apr-08 21:03
Hamid_RT17-Apr-08 21:03 
GeneralRe: SaveDC returning 0 Pin
Super Hornet17-Apr-08 22:11
Super Hornet17-Apr-08 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.