473,473 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[VS 2005] problem importing abstract class with interface

Hi,

To reproduce my problem I have created a solution with 4 projects:

1) CalledCpp - a cpp managed dll
2) CallerCpp - a cpp managed console project that depends on CalledCpp
3) CallerVB - a vb console project that depends on CalledCpp
4) CallerCS - a csharp console project that depends on CalledCpp

The main file of CalledCpp (CalledCpp.cpp) contains this code:

#include "stdafx.h"
#include "CalledCpp.h"

#define USE_INTERFACE

namespace CalledCpp
{

public interface class IoInterface
{
#if defined(USE_INTERFACE)
void read();
#endif
};

public ref class MyBase abstract : IoInterface
{
public:
static MyBase^ Create();
#if !defined(USE_INTERFACE)
virtual void read() abstract;
#endif
};

public ref class Derived : MyBase
{
public:
void read();
};

MyBase^ MyBase::Create()
{
return gcnew Derived();
}

void Derived::read()
{
System::Console::WriteLine("Derived::Read()");
}

}
/////////////////
The main file of CallerCpp (CallerCpp.cpp) contains this code:

#include "stdafx.h"

using namespace System;

int main()
{
CalledCpp::MyBase^ bas = CalledCpp::MyBase::Create();
bas->read();
}
////////////////

The main file of CallerCS (Program.cs) contains this code:

#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace CallerCS
{
class Test
{
static void Main(string[] args)
{
CalledCpp.MyBase bas = CalledCpp.MyBase.Create();
bas.read();
}
}
}
//////////////////////////////
The main file of CallerVB (Module1.vb) contains this code:

Module Module1

Sub Main()
Dim bas As CalledCpp.MyBase = CalledCpp.MyBase.Create()
Call bas.read()
End Sub

End Module
////////////////////////////////////
Now, CallerCpp, CallerCS and CallerVB have a project reference to CalledCpp.

If I perform a RebuildAll only CallerCpp builds fine while CallerVB and
CallerCS build return the same error:

error CS0117: 'CalledCpp.MyBase' does not contain a definition for 'read'

If I undefine USE_INTERFACE all works fine.

TIA for any help.
Marco.
--
For direct reply change underscore to dot

Nov 17 '05 #1
0 802

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
4
by: David Zha0 | last post by:
Hi, "when we call a virtual method, the runtime will check the instance who called the method and then choose the suitable override method, this may causes the performance drop down", is this...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.