Click here to Skip to main content
15,895,799 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener28-Feb-10 9:50
Edward Diener28-Feb-10 9:50 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Nish Nishant28-Feb-10 12:28
sitebuilderNish Nishant28-Feb-10 12:28 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener28-Feb-10 14:24
Edward Diener28-Feb-10 14:24 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Nish Nishant28-Feb-10 16:23
sitebuilderNish Nishant28-Feb-10 16:23 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
N a v a n e e t h1-Mar-10 23:18
N a v a n e e t h1-Mar-10 23:18 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
N a v a n e e t h1-Mar-10 23:19
N a v a n e e t h1-Mar-10 23:19 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener2-Mar-10 2:31
Edward Diener2-Mar-10 2:31 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
N a v a n e e t h2-Mar-10 5:06
N a v a n e e t h2-Mar-10 5:06 
Edward Diener wrote:
There is no reason interfaces should not have operators just like classes do.


I agree if .NET allows operator overloads as non-static methods. Unfortunately, .NET requires operator methods to be static and having static members to be part of an interface doesn't make sense. Because interface methods are used through the instance variable and static members are not accessible through instance variable. This is the reason why .NET uses interfaces like IComparable, IEquatable etc to do operations where a operator overload could have made more sense.

Edward Diener wrote:
Here is a simple, trivial example in C++/CLI:


If you don't care about your code to be used by other .NET languages, you can ensure the contract with the help of templates. Something like,
template<typename T>
int multiply(T first, T second)
{
	return first * second;
}
You can pass in any type that has got proper operator overloaded.

Smile | :)
Best wishes,
Navaneeth

GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener2-Mar-10 5:44
Edward Diener2-Mar-10 5:44 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
N a v a n e e t h2-Mar-10 6:57
N a v a n e e t h2-Mar-10 6:57 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener2-Mar-10 8:51
Edward Diener2-Mar-10 8:51 
QuestionRetrieving a control's information Pin
Jayapal Chandran23-Feb-10 23:29
Jayapal Chandran23-Feb-10 23:29 
AnswerRe: Retrieving a control's information Pin
Richard MacCutchan24-Feb-10 1:37
mveRichard MacCutchan24-Feb-10 1:37 
GeneralRe: Retrieving a control's information Pin
Ron Aldrich4-Mar-10 10:08
Ron Aldrich4-Mar-10 10:08 
GeneralRe: Retrieving a control's information Pin
Richard MacCutchan4-Mar-10 21:13
mveRichard MacCutchan4-Mar-10 21:13 
QuestionManaged Extensions in VS2008 ? Pin
gvanto23-Feb-10 12:23
gvanto23-Feb-10 12:23 
AnswerRe: Managed Extensions in VS2008 ? Pin
Richard Andrew x6423-Feb-10 14:51
professionalRichard Andrew x6423-Feb-10 14:51 
GeneralRe: Managed Extensions in VS2008 ? Pin
gvanto23-Feb-10 18:50
gvanto23-Feb-10 18:50 
GeneralRe: Managed Extensions in VS2008 ? Pin
Richard Andrew x6424-Feb-10 2:25
professionalRichard Andrew x6424-Feb-10 2:25 
GeneralRe: Managed Extensions in VS2008 ? Pin
gvanto24-Feb-10 13:54
gvanto24-Feb-10 13:54 
QuestionSending values to WPF control from VC++ Pin
Anu_Bala14-Feb-10 22:00
Anu_Bala14-Feb-10 22:00 
Questionusing microsoft enterprise library in .net dll to be called from COM application Pin
chana gibber10-Feb-10 5:02
chana gibber10-Feb-10 5:02 
AnswerRe: using microsoft enterprise library in .net dll to be called from COM application Pin
N a v a n e e t h10-Feb-10 5:18
N a v a n e e t h10-Feb-10 5:18 
GeneralRe: using microsoft enterprise library in .net dll to be called from COM application Pin
chana gibber10-Feb-10 5:22
chana gibber10-Feb-10 5:22 
GeneralRe: using microsoft enterprise library in .net dll to be called from COM application Pin
N a v a n e e t h10-Feb-10 5:28
N a v a n e e t h10-Feb-10 5:28 

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.