473,624 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface 'implements' bug in 1.1.4322

Came across this today using .NET Framework 1.1 Version 1.1.4322:

VB.Net code:

Public Interface IFace1
Property Foo
End Interface

Public Interface IFace2
Inherits IFace1

Property Bar Implements IFace1.AnyTextH ere
End Interface

---end---

This compiles fine!

My best guess is that the behavior seen is that since the
implementation of an interface member is deferred to classes that
implement the interface, the only compiler-time resolution done is to
verify that IFace1 exists.

I had no luck searching on this topic; is it a known bug or fixed in
2.0?

--gazarsgo

Dec 9 '05 #1
4 1085
Gazarsgo wrote:

This compiles fine!

Not on my machine with Option Strict On. It compiles with Option
Strict Off, however.
My best guess is that the behavior seen is that since the
implementation of an interface member is deferred to classes that
implement the interface, the only compiler-time resolution done is to
verify that IFace1 exists.


Try turning Option Strict On and see what you get.

Dec 9 '05 #2
Sorry, I thought it was verboten that I had Option Strict On and Option
Explicit On. I thought this was the case too though when I first ran
into an example of this code, but I replaced the missing Option
statements and still got no compile errors. What compile error did you
get, and what version of the .NET Framework are you running?

Here is a more complete example (a Console Application):
---start code---
Option Strict On
Option Explicit On

Public Interface TestIFace1

End Interface
Public Interface TestIFace2
Inherits TestIFace1
Property testProperty() As String Implements TestIFace1.Anyt hing

End Interface
Public Class TestClass1
Implements TestIFace2

Public Property testProperty() As String Implements
TestIFace2.test Property
Get
Return "Get"
End Get
Set(ByVal Value As String)
System.Console. Out.WriteLine(" Set: " & Value)
End Set
End Property

Public Shared Sub Main()
Dim o As TestIFace1
o = New TestClass1
System.Console. Out.WriteLine(C Type(o,
TestIFace2).tes tProperty())

End Sub
End Class

--endcode---

Thanks,
--gazarsgo

Dec 9 '05 #3
That code *does* compile and does not show any errors. But that is
slightly different than your previous code. Your previous code had a
property defined in the base interface. But it is really weird that
nothing is flagged.

Dec 12 '05 #4
Gazarsgo,
The same problem appears in .NET 2.0 also.

I consider it a bug as I would expect a compile error as Property Bar cannot
"implement" anything on IFace1, as IFace2 does not "implement" IFace1.
IFace2 *inherits* IFace1.
I will submit a query to MS to see what they have to say.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Gazarsgo" <ga******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
| Came across this today using .NET Framework 1.1 Version 1.1.4322:
|
| VB.Net code:
|
| Public Interface IFace1
| Property Foo
| End Interface
|
| Public Interface IFace2
| Inherits IFace1
|
| Property Bar Implements IFace1.AnyTextH ere
| End Interface
|
| ---end---
|
| This compiles fine!
|
| My best guess is that the behavior seen is that since the
| implementation of an interface member is deferred to classes that
| implement the interface, the only compiler-time resolution done is to
| verify that IFace1 exists.
|
| I had no luck searching on this topic; is it a known bug or fixed in
| 2.0?
|
| --gazarsgo
|
Dec 12 '05 #5

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

Similar topics

7
3662
by: yufufi | last post by:
lets say we have a 'shape' class which doesn't implement IComparable interface.. compiler doesn't give you error for the lines below.. shape b= new shape(); IComparable h; h=(IComparable)b; but it complains for the following lines
20
4248
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the interface and accessing the datastore MUST pass in a UserToken in the constructor of the object. Is this not possible? Am I forced to add the UserToken as a property on the object instead? /Ole
2
3441
by: Todd Brooks | last post by:
I have a coclass that implements a dual interface. The thing that's a little unusual is that the coclass doesn't inherit directly from the interface, rather it inherits from an implementation class that inherits from the interface. This means that by default the attribute code generator doesn't pick up the interface. According to the docs, I should be able to use the implements() attribute to tell the compiler that the coclass implements...
4
2844
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. '**************************************************************************** ' Issues '****************************************************************************
5
1666
by: Colin McGuire | last post by:
Hi all, when I write the class below Private Class employee End Class and then add the line "Implements IVF" which is an interface I have written, the IDE modifies my code to display
11
1488
by: sotto | last post by:
If i have this Interface: Public Interface MyInterface Function test() As Boolean Function test(ByVal MyVar As String) As Boolean End Interface And then i make a Public Class MyOwnClass
6
1935
by: Ricky W. Hunt | last post by:
It's dawning on my a lot of my problems with VB.NET is I'm still approaching it in the same way I've programmed since the late 70's. I've always been very structured, flow-charted everything, used subroutines, etc. Now I'm trying to study this new way and I'm getting some terms confused and can find no clear definition (some even overlap or use two different words for the same thing, even when they are actually different). I'm reading a...
12
1296
by: masoud bayan | last post by:
I've come across something in Interface implementation that I am not sure is correct behavior in VB.NET (and maybe C#) or not? Consider following example: Public Interface IShape
8
2074
by: rn5a | last post by:
Suppose I have the following class code: Imports System Imports System.Data Imports System.Data.SqlClient Public Class DBSettings Private sqlCmd As SqlCommand Private sqlConn As SqlConnection Public ConnectionString As String
0
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6112
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4084
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.