473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
Nov 20 '05 #1
1 3776
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" <sm*******@yahoo.com> wrote in message
news:b6**************************@posting.google.c om...
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

Nov 20 '05 #2

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

Similar topics

1
by: Russ Ford | last post by:
Hi all, 34.13-14 of the FAQ shows that to instantiate a template, you can make another source file that includes the .cc file where the definition of the functions is contained:...
5
by: Nomak | last post by:
Hello all, i have two template classes which needs each other. I tried to write some fwd decl / decl / impl in a good way but i can't get it to compile. Explanations: - .hh files are for...
0
by: Chris F Clark | last post by:
In our C++ project we have some internal bug reporting macros that we use to get useful information when the program does something unexpected. Essentially at the point of the error, we invoke an...
7
by: hopangtsun | last post by:
Hi all, I have encountered a problem on using the function template my goal is to add two numbers, which they can be int or double if I do this in this way template<class T> T addition(T a, T...
9
by: jc | last post by:
Hi all, I have a data type to use that I can't modify its codes. E.g. This template data type is data_type. When I declare a variable of this data_type, I write as following: data_type(8,...
4
by: Howard Gardner | last post by:
// I think that there is no way to write the template "cant_write_me" in // this example. Would love to be wrong. // one of many approaches that won't work template< template< typename class...
19
by: aaragon | last post by:
Hi everyone. A very simple question. I would like to know what is better in terms of performance. I want to use a simple function to obtain the minimum of two values. One way could be using a...
9
by: jedi200581 | last post by:
Hello, I have a singleton class that I'm using through macros: //snippet #define DO_SOMETHING ( myArgument) \ { \ MyClass *myObject = MyClass::getInstance(); \...
12
by: swellfr | last post by:
Hi if have simple macro defined this way: #define M_OPplus( classname ) typedef classname operator+(const classname& rhs); and a template class : template<typename X, typename Y> class...
4
by: suman.nandan | last post by:
Hi C++ Experts ! I have a little weird requirement. I have a base class, say B and lots of classes D1 .. Dn publicly derived from it. Over the course of development the number of derived...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
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
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
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...
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,...

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.