PC Review


Reply
Thread Tools Rate Thread

C++ Template Class or #define macro in VB.NET?

 
 
Michelle
Guest
Posts: n/a
 
      7th Sep 2003
I'm working on code that has several (approx 50) very similar objects.
They all inherit from a base class that can contain several of the
methods I need, but the methods that specifically need the object type
(e.g. code that creates objects with New) have to be implimented in
the code for the separate objects. In C++ I could use a template
class that would let me write code like this just once in a template
class. Is there anything like this available in vb.net?

The vs.net regular expression search and replace has made it easier to
edit all 50 pieces of code at once, but it would be great if the code
was only there once!

TIA -- Marie
 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      7th Sep 2003
Michelle,
You will need to wait for Whidbey (VS.NET 2004) for Generics, .NET
equivalent of C++ Templates.

http://msdn.microsoft.com/vstudio/pr...o/roadmap.aspx
http://msdn.microsoft.com/msdnmag/is...T/default.aspx

#define macros are not support.

I do not have links handy, there are a couple of collection generator
add-ins available that will create the skeleton collection classes for you.
You might try searching this newsgroup in groups.google.com for links, or
searching user samples at www.gotdotnet.com.

Hope this helps
Jay


"Michelle" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm working on code that has several (approx 50) very similar objects.
> They all inherit from a base class that can contain several of the
> methods I need, but the methods that specifically need the object type
> (e.g. code that creates objects with New) have to be implimented in
> the code for the separate objects. In C++ I could use a template
> class that would let me write code like this just once in a template
> class. Is there anything like this available in vb.net?
>
> The vs.net regular expression search and replace has made it easier to
> edit all 50 pieces of code at once, but it would be great if the code
> was only there once!
>
> TIA -- Marie



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define class properties shapper Microsoft C# .NET 0 23rd Dec 2008 09:44 PM
template template parameter used as base class of ref class error =?Utf-8?B?Uml0dWFsRGF2ZQ==?= Microsoft VC .NET 2 14th Jun 2006 10:38 PM
Can we define a static class ad Microsoft C# .NET 15 21st Mar 2005 09:09 AM
[BUG] ICE cause by template class with constructor-like declaration with name of different class and template const parameters Sven Groot Microsoft VC .NET 3 18th Dec 2004 12:25 AM
BUG VC7.1: in class friend template function definition does not have access to the class's template parameters Maxim Yegorushkin Microsoft VC .NET 5 6th Jun 2004 02:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:32 PM.