Click here to Skip to main content
15,912,457 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with C and C++ together in one application Pin
George_George15-Apr-06 23:12
George_George15-Apr-06 23:12 
GeneralRe: Working with C and C++ together in one application Pin
Chris Losinger16-Apr-06 5:34
professionalChris Losinger16-Apr-06 5:34 
GeneralRe: Working with C and C++ together in one application Pin
George_George16-Apr-06 19:38
George_George16-Apr-06 19:38 
GeneralRe: Working with C and C++ together in one application Pin
Chris Losinger17-Apr-06 1:03
professionalChris Losinger17-Apr-06 1:03 
GeneralRe: Working with C and C++ together in one application Pin
George_George19-Apr-06 22:36
George_George19-Apr-06 22:36 
AnswerRe: Working with C and C++ together in one application Pin
David Crow14-Apr-06 2:45
David Crow14-Apr-06 2:45 
GeneralRe: Working with C and C++ together in one application Pin
George_George15-Apr-06 23:09
George_George15-Apr-06 23:09 
GeneralRe: Working with C and C++ together in one application Pin
David Crow17-Apr-06 3:04
David Crow17-Apr-06 3:04 
George_George wrote:
You mentioned "Just create an instance of the C++ object and use its methods just like you would from anyplace else.". Could you show me your points by a simple sample please?


If you have a class named MyClass, the following will create an instance of that class called mc:

MyClass mc;
George_George wrote:
I do not quite understand what you said I can create an instance of a C++ class in a C file...


The file will have to have a .cpp extension. Otherwise, the compiler will not recognize any of the C++ code contained within.

George_George wrote:
...since I can not imagine that C compiler can recognize C++ class.


Of course.

George_George wrote:
Another question is that, why should I define C code in a .cpp file? I need to define it in .c file in my application.


You seem to have a bit of confusion between the two. C++ is everything that C is plus classes. So, I could put the following in a .cpp file:

void main( void )
{
    int x = 5;
    printf("%d\n", x);
    return;
}
Is that C or C++ code?


"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

"There is no death, only a change of worlds." - Native American Proverb


GeneralRe: Working with C and C++ together in one application Pin
George_George19-Apr-06 22:44
George_George19-Apr-06 22:44 
Questionsome basic one plz Pin
Krishnatv13-Apr-06 23:45
Krishnatv13-Apr-06 23:45 
AnswerRe: some basic one plz Pin
Cedric Moonen14-Apr-06 0:12
Cedric Moonen14-Apr-06 0:12 
GeneralRe: some basic one plz Pin
Krishnatv14-Apr-06 0:38
Krishnatv14-Apr-06 0:38 
AnswerRe: some basic one plz Pin
Maxwell Chen14-Apr-06 1:44
Maxwell Chen14-Apr-06 1:44 
GeneralRe: some basic one plz Pin
toxcct14-Apr-06 1:58
toxcct14-Apr-06 1:58 
GeneralRe: some basic one plz Pin
Maxwell Chen14-Apr-06 2:07
Maxwell Chen14-Apr-06 2:07 
QuestionRe: some basic one plz Pin
David Crow14-Apr-06 2:49
David Crow14-Apr-06 2:49 
AnswerRe: some basic one plz Pin
toxcct14-Apr-06 2:51
toxcct14-Apr-06 2:51 
GeneralRe: some basic one plz Pin
David Crow14-Apr-06 3:56
David Crow14-Apr-06 3:56 
GeneralRe: some basic one plz Pin
toxcct14-Apr-06 4:01
toxcct14-Apr-06 4:01 
AnswerFrom ISO/IEC 14882:2003(E) Pin
Maxwell Chen14-Apr-06 6:51
Maxwell Chen14-Apr-06 6:51 
GeneralRe: From ISO/IEC 14882:2003(E) Pin
toxcct15-Apr-06 1:04
toxcct15-Apr-06 1:04 
QuestionHight Quality Bitmap Stretching Displaying? Pin
Abin13-Apr-06 23:29
Abin13-Apr-06 23:29 
AnswerRe: Hight Quality Bitmap Stretching Displaying? Pin
Chris Losinger14-Apr-06 2:27
professionalChris Losinger14-Apr-06 2:27 
Questionhow to create a button using DLL Pin
baldha rakesh13-Apr-06 23:16
baldha rakesh13-Apr-06 23:16 
AnswerRe: how to create a button using DLL Pin
CodeVarma14-Apr-06 19:11
CodeVarma14-Apr-06 19: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.