Click here to Skip to main content
15,868,164 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMessage Closed Pin
13-Aug-22 4:09
Member 1496877113-Aug-22 4:09 
GeneralRe: how to resolve and understand how / why it works or not Pin
Richard MacCutchan13-Aug-22 4:28
mveRichard MacCutchan13-Aug-22 4:28 
GeneralMessage Closed Pin
13-Aug-22 6:12
Member 1496877113-Aug-22 6:12 
GeneralRe: how to resolve and understand how / why it works or not Pin
Richard MacCutchan13-Aug-22 6:25
mveRichard MacCutchan13-Aug-22 6:25 
QuestionMessage Closed Pin
11-Aug-22 11:18
Member 1496877111-Aug-22 11:18 
AnswerRe: #define won't work in QStringList , gives no error Pin
Mircea Neacsu11-Aug-22 11:57
Mircea Neacsu11-Aug-22 11:57 
GeneralRe: #define won't work in QStringList , gives no error Pin
David Crow11-Aug-22 16:03
David Crow11-Aug-22 16:03 
Questionmanaging objects derived from the same base class using a container Pin
Calin Negru10-Aug-22 3:29
Calin Negru10-Aug-22 3:29 
I can`t think of a way to store in an array objects of different type but with same base class so I`m going to use a STL container instead:
C++
class somebaseclass
{

}
class derivedclass: private somebaseclass
{

} 
class anotherderivedclass: private somebaseclass
{

}     

vector<somebaseclass *>  * AllObjects;
derivedclass * Derived1 = new derivedclass[1];
anotherderivedclass * Derived2 = new anotherderivedclass[1];

AllObjects->push_back((somebaseclass)Derived1);
AllObjects->push_back((somebaseclass)Derived2);


Is this how it should be done?

modified 10-Aug-22 9:47am.

AnswerRe: managing objects derived from the same base class using a container Pin
Mircea Neacsu10-Aug-22 3:55
Mircea Neacsu10-Aug-22 3:55 
AnswerRe: managing objects derived from the same base class using a container Pin
Greg Utas10-Aug-22 3:56
professionalGreg Utas10-Aug-22 3:56 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru10-Aug-22 6:34
Calin Negru10-Aug-22 6:34 
AnswerRe: managing objects derived from the same base class using a container Pin
Richard MacCutchan10-Aug-22 4:01
mveRichard MacCutchan10-Aug-22 4:01 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru10-Aug-22 6:33
Calin Negru10-Aug-22 6:33 
GeneralRe: managing objects derived from the same base class using a container Pin
Richard MacCutchan10-Aug-22 6:40
mveRichard MacCutchan10-Aug-22 6:40 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru10-Aug-22 11:14
Calin Negru10-Aug-22 11:14 
GeneralRe: managing objects derived from the same base class using a container Pin
k505410-Aug-22 13:01
mvek505410-Aug-22 13:01 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru10-Aug-22 21:25
Calin Negru10-Aug-22 21:25 
GeneralRe: managing objects derived from the same base class using a container Pin
Richard MacCutchan10-Aug-22 21:10
mveRichard MacCutchan10-Aug-22 21:10 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru11-Aug-22 0:38
Calin Negru11-Aug-22 0:38 
GeneralRe: managing objects derived from the same base class using a container Pin
Richard MacCutchan11-Aug-22 0:39
mveRichard MacCutchan11-Aug-22 0:39 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru11-Aug-22 0:57
Calin Negru11-Aug-22 0:57 
GeneralRe: managing objects derived from the same base class using a container Pin
Calin Negru12-Aug-22 18:58
Calin Negru12-Aug-22 18:58 
GeneralRe: managing objects derived from the same base class using a container Pin
Richard MacCutchan12-Aug-22 21:55
mveRichard MacCutchan12-Aug-22 21:55 
Questionmoving graphics in a win32 c++ window Pin
Calin Negru9-Aug-22 8:25
Calin Negru9-Aug-22 8:25 
AnswerRe: moving graphics in a win32 c++ window Pin
Gerry Schmitz9-Aug-22 9:15
mveGerry Schmitz9-Aug-22 9:15 

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.