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

Managed C++/CLI

 
GeneralRe: Dll Pin
MsmVc25-Feb-10 22:20
MsmVc25-Feb-10 22:20 
GeneralRe: Dll Pin
Richard MacCutchan25-Feb-10 22:59
mveRichard MacCutchan25-Feb-10 22:59 
GeneralRe: Dll Pin
MsmVc25-Feb-10 23:09
MsmVc25-Feb-10 23:09 
GeneralRe: Dll Pin
Richard MacCutchan26-Feb-10 0:08
mveRichard MacCutchan26-Feb-10 0:08 
QuestionCannot inspect... Assuming significant changes. Please help! Pin
Xpnctoc25-Feb-10 13:48
Xpnctoc25-Feb-10 13:48 
AnswerRe: Cannot inspect... Assuming significant changes. Please help! Pin
Xpnctoc26-Feb-10 3:10
Xpnctoc26-Feb-10 3:10 
GeneralRe: Cannot inspect... Assuming significant changes. Please help! Pin
Xpnctoc26-Feb-10 3:47
Xpnctoc26-Feb-10 3:47 
QuestionC++/CLI operators in ref classes and interface classes Pin
Edward Diener24-Feb-10 14:33
Edward Diener24-Feb-10 14:33 
In C++/CLI if I add an operator to an interface class and implement that interface in a ref class, the operator is not recognized for the ref class. But if I add an operator to a base ref class and inherit from that base ref class in a derived ref class, the operator is recognized for that derived ref class:

#include "stdafx.h"

using namespace System;

interface class Base
  {
  
  public:
  
	static int operator * (Base ^ it) { return 3; }
  
  };
  
ref class Derived : Base
  {
  
  };

int main(array<System::String ^> ^args)
{

    Derived ^ d(gcnew Derived);
    
    int amt = *d;

    Console::WriteLine(L"Hello World");
    return 0;
}


The above compiles with an error of:

error C2440: 'initializing' : cannot convert from 'Derived' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

But if one changes the line in the code above from 'interface class base' to 'ref class base', the code compiles and runs with no errors.

Does anybody know why this behavior occurs ?
Edward Diener

AnswerRe: C++/CLI operators in ref classes and interface classes Pin
Richard Andrew x6425-Feb-10 14:43
professionalRichard Andrew x6425-Feb-10 14:43 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener26-Feb-10 2:03
Edward Diener26-Feb-10 2:03 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Richard Andrew x6426-Feb-10 3:50
professionalRichard Andrew x6426-Feb-10 3:50 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener26-Feb-10 5:21
Edward Diener26-Feb-10 5:21 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Richard Andrew x6426-Feb-10 5:26
professionalRichard Andrew x6426-Feb-10 5:26 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener26-Feb-10 10:44
Edward Diener26-Feb-10 10:44 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Nish Nishant28-Feb-10 8:24
sitebuilderNish Nishant28-Feb-10 8:24 
AnswerRe: C++/CLI operators in ref classes and interface classes Pin
Nish Nishant28-Feb-10 8:22
sitebuilderNish Nishant28-Feb-10 8:22 
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 
GeneralRe: C++/CLI operators in ref classes and interface classes Pin
Edward Diener2-Mar-10 5:44
Edward Diener2-Mar-10 5: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.