Wednesday, May 16, 2007

Conversion of CString to char* and char* to CString

Hi Friends


while writing programs i often face the problem related with Conversion.
these are the basic conversion


Conversion of CString to char*

char* pchValue;
CString stValue;

pchValue = stValue.GetBuffer(0);

Conversion of char* to CString

char pchValue[] = "My Name";
CString stValue(pchValue);

Thanks
Pankaj Singh

Labels:

Tuesday, May 15, 2007

Copy constructor Basic

This article will describe the Basics of Copy Constructor.


When u create any object and want to initialize that object on same time with another same type object this time your normal constructor is not called although a special type of Copy Constructor is called by compiler and this special constructor is Copy Constructor.


MyObject A;
MyObject B;
B=A; //this time normal constructor will call

MyObject A;
MyObject B = A; //this time Copy constructor will call

In next Atricle i will explain what is the need of Copy Constructor.