Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2006, 10:46 PM
Registered User
 
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cross langauge inheritance

Dear Friends,

      I have written C# class library with overloaded methods namely,
1.Add() &
2.add().

Since C# is case sensitive it will accept this. But If I inherit this in VB.NET the method Add() only is accessible. Plz explain me the reason behind this.

Ram Kumar.N.D.

 
Old September 29th, 2006, 05:00 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

All flavors of C are case-sensitive. (And Java as well.)
VB has always "corrected" mistyped atom names to whatever was the first use of that name.
If you type
Code:
    Dim rEgion As String

    REGion = "Pacific Northwest"
    VB will change your typing to cause the result to be
Code:
    Dim rEgion As String
Code:
    rEgion = "Pacific Northwest"
    Try the CallByName method, and see if that maintains your case distinction.

By the way, having two routines with the same name but in a different case is very bad form. It not only leads to problems like you are writing about, but makes it so that typing incorrectly (or even just having your mind wander for a few keystrokes) will never be caught by the compiler as an error.
 
Old September 30th, 2006, 08:13 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

One of the Microsoft API design guidelines is that you should never expose public methods that differ only in casing of the name. While this works in C# because it's a case sensitive language, it's not CLR compliant because there are other languages that are case insensitive.

Why have you chosen for a different name in casing only? Is it possible to accomplish the same thing with, for example, an overload?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Different Langauge Issue Chapter 11 rrsalinas BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 April 10th, 2008 01:28 PM
What langauge was this app written in? flavour404 Other Programming Languages 14 March 8th, 2007 11:37 AM
C# as a scripting langauge simsdagr8 C# 2005 1 November 8th, 2006 11:12 AM
Langauge problem sufi_assem J2EE 0 December 31st, 2004 06:45 PM
Cross Language Inheritance ndr1977 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 July 29th, 2003 08:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.