473,398 Members | 2,427 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,398 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 11 '05 #1
1 1601
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 11 '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; ..
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...
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...
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:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.