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
Implements MyInterface
End Class
When i hit [Enter] after the Implements MyInterface
Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t
End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean
Implements MyInterface.tes t
End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name?
Why doesn't it just make a test() and a test(ByVal Myvar As string)
function?
Is there a specific reason for this behaviour? 11 1490
"sotto" <ju**@sotto.inv alid> schrieb 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 Implements MyInterface End Class
When i hit [Enter] after the Implements MyInterface Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean Implements MyInterface.tes t End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name? Why doesn't it just make a test() and a test(ByVal Myvar As string) function? Is there a specific reason for this behaviour?
If you've already got a procedure with the name "test", the IDE uses this
kind of numbering. In this case, it wouldn't be necessary, so you're right.
I'd post it again in microsoft.publi c.vsnet.ide.
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
* sotto <ju**@sotto.inv alid> scripsit: 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 Implements MyInterface End Class
When i hit [Enter] after the Implements MyInterface Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean Implements MyInterface.tes t
End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name? Why doesn't it just make a test() and a test(ByVal Myvar As string) function?
Is there a specific reason for this behaviour?
I currently don't have VS.NET 2003 here, but if it names it with an "1"
at the end of the name it is maybe a bug.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
> I currently don't have VS.NET 2003 here, but if it names it with an "1" at the end of the name it is maybe a bug.
I use VS2003 and it does name overloaded interface methods with an number
suffix.
e.g.
Test()
Test1()
Test2()
etc.
Trev.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ez******** *****@TK2MSFTNG P10.phx.gbl... * sotto <ju**@sotto.inv alid> scripsit: 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 Implements MyInterface End Class
When i hit [Enter] after the Implements MyInterface Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean Implements MyInterface.tes t
End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name? Why doesn't it just make a test() and a test(ByVal Myvar As string) function?
Is there a specific reason for this behaviour?
I currently don't have VS.NET 2003 here, but if it names it with an "1" at the end of the name it is maybe a bug.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
VS.net uses "proc", "proc1", "proc2" .... type naming when generating
function names for you. If it generates "proc", but that name already
exists, then it will try "proc1". If that exists, it will try "proc2", and
so on...
While the generator COULD use method overloads, overloading a method only
makes sense if the functions are closely related. VS.NET really doesn't
know if they're related or not, so it names them uniquely. This naming is
applied in all cases, even when using the same name isn't an issue.
"sotto" <ju**@sotto.inv alid> wrote in message
news:G9******** *************@h estia.telenet-ops.be... 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 Implements MyInterface End Class
When i hit [Enter] after the Implements MyInterface Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean Implements MyInterface.tes t End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name? Why doesn't it just make a test() and a test(ByVal Myvar As string) function? Is there a specific reason for this behaviour?
Herfried,
As Trev stated, it "numbers" the members when they are overloaded, I suspect
for the reason Armin cited.
The numbering partially makes senses when the class had a Test function with
a different return type before I added the interface! I'm sure numbering is
the "easy way" to implement it. ;-)
However! more oft then not, I do not want the methods numbered, I either
want implicitly or explicit interface implementation (to borrow the C#
term).
' implicit interface implementation Public Function test() As Boolean Implements MyInterface.tes t End Function
Public Function test(ByVal MyVar As String) As Boolean Implements MyInterface.tes t
Public Function test() As String
End Function
' explicit interface implementation Private Function MyInterface_tes t() As Boolean Implements
MyInterface.tes t End Function
Private Function MyInterface_tes t(ByVal MyVar As String) As Boolean Implements MyInterface.tes t
Also in this context the Overloads normally is not needed, I'm suspect its
injected incase I am implementing the interface in a class that already has
a Test method inherited from a base class.
Just a thought
Jay
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ez******** *****@TK2MSFTNG P10.phx.gbl... * sotto <ju**@sotto.inv alid> scripsit: 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 Implements MyInterface End Class
When i hit [Enter] after the Implements MyInterface Visual Studio automatically creates
Public Overloads Function test() As Boolean Implements MyInterface.tes t End Function
Public Overloads Function test1(ByVal MyVar As String) As Boolean Implements MyInterface.tes t
End Function
These two functions for me...
Why does it add the 1 on the overloaded function-name? Why doesn't it just make a test() and a test(ByVal Myvar As string) function?
Is there a specific reason for this behaviour?
I currently don't have VS.NET 2003 here, but if it names it with an "1" at the end of the name it is maybe a bug.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
* "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> scripsit: The numbering partially makes senses when the class had a Test function with a different return type before I added the interface! I'm sure numbering is the "easy way" to implement it. ;-)
Seems to be a "quick and dirty" solution...
;-)
However! more oft then not, I do not want the methods numbered, I either want implicitly or explicit interface implementation (to borrow the C# term).
I don't like numbered methods too.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Herfried,
Aren't "easy way" and "quick and dirty" synonyms?
:-))
Jay
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:bu******** ****@ID-208219.news.uni-berlin.de... * "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> scripsit: The numbering partially makes senses when the class had a Test function
with a different return type before I added the interface! I'm sure numbering
is the "easy way" to implement it. ;-)
Seems to be a "quick and dirty" solution...
;-)
However! more oft then not, I do not want the methods numbered, I either want implicitly or explicit interface implementation (to borrow the C# term).
I don't like numbered methods too.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
Hi Jay B,
I hope you don't mind I answer also? Aren't "easy way" and "quick and dirty" synonyms?
I think not, they are opposites in my eyes.
Keep it simple is not only a term I often use.
If you cannot "Keep it simple", the "quick and dirty" way is mostly the bad
solution.
(About that we do not have to argue).
Just a thought,
Cor
> Aren't "easy way" and "quick and dirty" synonyms?
"easy way", "quick and dirty" and "quick and beautiful" are in the eyes of
the beholder ;) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Angus Leeming |
last post by:
Dinkumware's online STL reference http://tinyurl.com/3es52 declares
std::map's overloaded erase member functions to have the interface:
map::erase
iterator erase(iterator where);
iterator erase(iterator first, iterator last);
size_type erase(const Key& keyval);
Ie, the first two functions above have the same interface as
|
by: bahadir.balban |
last post by:
Hi,
What's the best way to implement an overloaded function in C? For
instance if you want to have generic print function for various
structures, my implementation would be with a case statement:
void print_structs(void * struct_argument, enum struct_type stype)
{
switch(stype) {
case STRUCT_TYPE_1:
|
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...
|
by: Mark |
last post by:
I create a simple interface in a com object:
public interface ISimple
{
void a();
int b();
}
I build the object in Visual Studio and load the object from Excel. I can call a and b without any problems.
|
by: =?Utf-8?B?Sm9obg==?= |
last post by:
Hi all,
I am developing website application in asp.net , visual C# and atl com. I
am using atl com component in visual C# application. One of the function of
com component interface returns IStream interface.
I want to read data from that IStream interface. I am new to visual c#. I
have written some code. But, it is returning whole data. It is returning some
null characters.
| |
by: mersinli |
last post by:
Hi,
I have got seven error and I dont find why compiler find error..
//commission class definition
#ifndef COMMISSION_H
#define COMMISSION_H
#include <string>
using std::string;
|
by: SlimT88 |
last post by:
I recently created a simple class for a homework assignment and ran into compilation errors concerning overloaded global functions. I've copied the relevant parts of my code below and the errors generated on two compilers
Class Definition:
class BDay
{ //Should Be Global Scope
bool operator==( const BDay & , const BDay &);
bool operator!=( const BDay & , const BDay &);
friend ostream & operator<<( ostream &, const BDay...
|
by: Jwe |
last post by:
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should display
the Windows form. The form is being displayed but the command
only returns when the form is closed. I want the command line to
return immediately, leaving the form displayed.
|
by: Random.Coder |
last post by:
The output of this simple program below differs if it's compiled in
Visual Studio 2005 and 2008. Is one the correct output, and if so,
why?
using System;
namespace DerivedTestApp
{
class BaseClass
{
|
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,...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |