Click here to Skip to main content
15,889,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI all

i want to know when i create C++ CLI based program then how to do coding
in .cpp and .h files

like in vc6
i user


// in this i just declare function inside the class

test.h
C++
class testone
{
// function declare
void hellow(int one);
int two(int a ,int b)
};

// in cp i give the definition of functions
test.cpp
C++
void testone::hellow(int one)
{

.... do some work
}

int testone::two(int a,int b)
{

do some operation ...
}


// use of these files in other .cpp files
// variant.cpp

#include "test.h"

// now if i want to use test.h functions
//create object of class of test.h
C++
testone testoneObj;

 testoneObj.two(2,5);
 testoneObj.hellow(argu);

how to do this all in CLR of c++ in .net
if i give definition in CLR IN .CPP files it gives me error
it also not use :: for the class to acces its functions in header file
plz help how to do this

Regards
Posted
Updated 8-Oct-12 18:33pm
v2

1 solution

been here, tried it once...

In short - forget about it. It was a MS way to bring C++ programmers to .Net.

They abused the C++ so badly that it is now (I believe) deprecated.

If you really need to write a .net app, use C#.

However, if you really need to use C++, then read perhaps this, or this.

Basically, when you create a class like you did, it becomes a __gc class, nad needs to be initialised with gcnew operator.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900