Click here to Skip to main content
15,892,537 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to increase concurrent rate of a server application Pin
Richard MacCutchan21-Feb-12 5:20
mveRichard MacCutchan21-Feb-12 5:20 
AnswerRe: How to increase concurrent rate of a server application Pin
Randor 21-Feb-12 8:32
professional Randor 21-Feb-12 8:32 
QuestionWin7 - worker thread freeze on call to WaitForSingleObject Pin
Stan the man21-Feb-12 0:12
Stan the man21-Feb-12 0:12 
AnswerRe: Win7 - worker thread freeze on call to WaitForSingleObject Pin
Jochen Arndt21-Feb-12 0:29
professionalJochen Arndt21-Feb-12 0:29 
GeneralRe: Win7 - worker thread freeze on call to WaitForSingleObject Pin
Stan the man21-Feb-12 1:31
Stan the man21-Feb-12 1:31 
AnswerRe: Win7 - worker thread freeze on call to WaitForSingleObject Pin
bjorn_ht21-Feb-12 1:16
bjorn_ht21-Feb-12 1:16 
AnswerRe: Win7 - worker thread freeze on call to WaitForSingleObject Pin
Erudite_Eric21-Feb-12 2:31
Erudite_Eric21-Feb-12 2:31 
QuestionInitializing base class data Pin
SunilKrSingh20-Feb-12 3:46
SunilKrSingh20-Feb-12 3:46 
class Base
{
char * ptr;

public:
Base(){}
Base(char * str)
{
ptr = new char[strlen(str)];
strcpy(ptr,str);
}

};

class Derived : public Base
{
char * ptr_s;
public:

Derived(char * str1,char * str2):Base(str2)
{
ptr_s = new char[strlen(str1)];
strcpy(ptr_s,str1);
}
Derived(const Derived & sec)//:Base(sec.ptr)
{
this->ptr_s = new char[strlen(sec.ptr_s)];
strcpy(this->ptr_s,sec.ptr_s);

}

};


int _tmain(int argc, _TCHAR* argv[])
{

Derived Obj1("sunil","singh");

Derived Obj2 = Obj1;

return 0;
}


Obj1 is a derived class object where base class char pointer is initialized with "singh" and
derived class char pointer is initilized with "sunil". I want to create Obj2 out of Obj1. Separate memory should be created for
Obj2 char pointer (base part and derived part as well) and that should be initialized with the strings contained in Obj1.
Here the problem is: Derived class part can be initialized with copy constructor. How to initialize the base class char poniter of Obj2 with the base class part of Obj1. char pointers in
both the classes are private.

I tried using initializer list but could not succeed.

Is there some proper way to do this?

Thanks for any help or suggestion in advance.
AnswerRe: Initializing base class data Pin
prasad_som20-Feb-12 6:49
prasad_som20-Feb-12 6:49 
AnswerRe: Initializing base class data Pin
enhzflep20-Feb-12 14:02
enhzflep20-Feb-12 14:02 
GeneralRe: Initializing base class data Pin
SunilKrSingh20-Feb-12 18:37
SunilKrSingh20-Feb-12 18:37 
GeneralRe: Initializing base class data Pin
enhzflep20-Feb-12 18:53
enhzflep20-Feb-12 18:53 
GeneralRe: Initializing base class data Pin
SunilKrSingh20-Feb-12 19:02
SunilKrSingh20-Feb-12 19:02 
QuestionIplImage to Halcon Image Pin
Member 788510519-Feb-12 16:19
Member 788510519-Feb-12 16:19 
AnswerRe: IplImage to Halcon Image Pin
Richard MacCutchan19-Feb-12 22:09
mveRichard MacCutchan19-Feb-12 22:09 
QuestionHOWTO: HH.exe is not listed in taskmgr.exe Pin
cyysoft17-Feb-12 16:14
cyysoft17-Feb-12 16:14 
AnswerRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Rajesh R Subramanian17-Feb-12 18:45
professionalRajesh R Subramanian17-Feb-12 18:45 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Richard Andrew x6418-Feb-12 10:19
professionalRichard Andrew x6418-Feb-12 10:19 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Albert Holguin18-Feb-12 14:27
professionalAlbert Holguin18-Feb-12 14:27 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
KASR121-Feb-12 6:50
KASR121-Feb-12 6:50 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Eddy Vluggen21-Feb-12 8:52
professionalEddy Vluggen21-Feb-12 8:52 
QuestionShare C file across dll boundaries Pin
LionAM17-Feb-12 12:40
LionAM17-Feb-12 12:40 
AnswerRe: Share C file across dll boundaries Pin
Chris Losinger17-Feb-12 18:09
professionalChris Losinger17-Feb-12 18:09 
AnswerRe: Share C file across dll boundaries Pin
Richard MacCutchan17-Feb-12 21:16
mveRichard MacCutchan17-Feb-12 21:16 
GeneralRe: Share C file across dll boundaries Pin
LionAM18-Feb-12 9:44
LionAM18-Feb-12 9:44 

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.