473,385 Members | 2,180 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,385 software developers and data experts.

Runtime Type Determination

I have two subclass deriving from a common base class. The base class
exposes two shared functions for serialization and deserialization in XML
format and some other methods that are overrided by the derived classes. I
want to be able to serialize and deserialize the derived classes through the
methods in the base class, without explicitly passing the type of the
object. I want to determine at runtime the type of the derived class calling
the function and Serialize and deserialize based on that type. How do I
achieve this?

For example:

The client will call ObjA.Serialize(), where objA is a derived class and
Serialize is a method implemented in the parent class. How do I determine
the type of the derived class calling the Function? Is there an inbuilt
mechanism, like Reflection etc..., that could help in this mechanism?

Thanks in advance,
regards,
Chris

Nov 19 '05 #1
1 1139
this.GetType() ?
"Christopher Pragash" <ch**********@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
I have two subclass deriving from a common base class. The base class
exposes two shared functions for serialization and deserialization in XML
format and some other methods that are overrided by the derived classes. I
want to be able to serialize and deserialize the derived classes through the methods in the base class, without explicitly passing the type of the
object. I want to determine at runtime the type of the derived class calling the function and Serialize and deserialize based on that type. How do I
achieve this?

For example:

The client will call ObjA.Serialize(), where objA is a derived class and
Serialize is a method implemented in the parent class. How do I determine
the type of the derived class calling the Function? Is there an inbuilt
mechanism, like Reflection etc..., that could help in this mechanism?

Thanks in advance,
regards,
Chris


Nov 19 '05 #2

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

Similar topics

4
by: Master of C++ | last post by:
Hi, This is a simple question. In the following example, .. class Vector .. { .. private: .. int *Numbers; .. int vLength; ..
1
by: Christopher Pragash | last post by:
I have two subclass deriving from a common base class. The base class exposes two shared functions for serialization and deserialization in XML format and some other methods that are overrided by...
29
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array...
6
by: Pete | last post by:
Hi, Is it possible for an application to determine, at runtime, whether an arbitrary class supports a known interface? I can think of a couple of cludgy ways of doing this (the calling app...
0
by: Corno | last post by:
Hi all, I'm making a menu page in ASP.NET in which I present the user with a list of pages that are available to him. In the web.config I will add a list of url's of all the pages. Those pages...
2
by: derekbarrett | last post by:
Hi, I found this article in DB2 magazine and learned about the Problem Determination Mastery Exam. I am very interested in taking the exam, however, following the links in the article leads to...
7
by: john | last post by:
Hi to All I would like to do something similar: class Class1<T1> { } class Class2<T2, T1where T2: Class1<T1>, new() {
9
by: manish | last post by:
we have avariablr int bps; // bps determined during run time - - - how can we make conditional declaration of a variable y we want appropriate declaration depending upon bps.
2
by: Paul Rudin | last post by:
I'm have a little experiment with mod_python. I'm trying to figure out how to get hold of the original Content-Type header. In my config file I have: <Directory /var/www/test/atom> AddHandler...
1
by: graju80 | last post by:
Question: What are the rules that DB2 uses to determine the right datatype for a particular column for on-the-fly SQL generation? For example... The following code snippet:
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.