473,769 Members | 6,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

implementing isInstanceOf() in C, any ideas ???

Hi,

I am thinking about implementing isInstanceOf() in c.
Any ideas ???
Ex.
int findType(struct x)
{
struct X orgX;
if (isInstanceOf(x , orgX))
return 1;
else
return 0;

}
main()
{
struct Y x;
int val=0;
val=findType(x) ;
}
Regards,
Abhishek

Jul 10 '06 #1
3 1428
dwaach wrote:
Hi,

I am thinking about implementing isInstanceOf() in c.
Any ideas ???
Yes: you're rather out of your depth. Put some effort into
learning C first.

--
Chris "object disoriented" Dollin
"Never ask that question!" Ambassador Kosh, /Babylon 5/

Jul 10 '06 #2
learn from where and what to learn?

Chris Dollin wrote:
dwaach wrote:
Hi,

I am thinking about implementing isInstanceOf() in c.
Any ideas ???

Yes: you're rather out of your depth. Put some effort into
learning C first.

--
Chris "object disoriented" Dollin
"Never ask that question!" Ambassador Kosh, /Babylon 5/
Jul 10 '06 #3
dwaach wrote:
learn from where and what to learn?
For starters, learn not to top-post.

Learn C from where: I'd say K&R2. Take your time, ask questions
if you get stuck.

What to learn: the language and it's style.

Noting, in particular, that C is /not/ the kind of language for
which isInstanceOf is a terribly useful question. If someone
wants to do so, I anticipate two major possibilities:

(a) they have completely the wrong idea about what kind of
language C is, and would be better off with a different
one: /which/ different one I'd not like to guess.

(b) they're implementation-oriented people who need to put
an OO layer over C and need to know what C promises so
they can do so as safely as their context permits.

(b) people are likely to come with rather more specific questions
and code snippets. (a) people are likely out of their depth.

I reserve my right to be wrong: I've worked hard for it.

--
Chris "with a quota" Dollin
"We did not have time to find out everything we wanted to know." /A Clash of Cymbals/

Jul 10 '06 #4

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

Similar topics

2
2705
by: Dmitri Zhukov | last post by:
Hello everyone, I am implementing software which has a medium sized number of text strings (max 100K) which are represented in a listbox. I want user to be able to search the string by typing the first letters of the record and showing coinciding record if any (similar to quickserach functionality of Norton/Total commander). So i guess I need some kind of hasing algorithm to be able to find string by its prefix. Any recommendations?
3
4508
by: Ivan Neganov | last post by:
Hi, I have a custom subclass of System.IO.Stream type. I wonder how to correctly implement the IDisposable pattern in this situation. The parent Stream type apparently uses explicit interface implementation, and I could not find a way for my child type to override parent's IDisposable.Dispose() method. The intention was to clean up child's resources first,
4
2069
by: Frank J. Reashore | last post by:
Hello Everyone, I am implementing a simple interface in C# using Visual Studio .net and was quite surprised to discover that the C# compiler does NOT complain if a method on the interface is not implemented. VB.net on the other hand generates a compile error if a method is not implemented. This helps in ensuring that all interface methods are implemented.
7
2097
by: Scott M. | last post by:
In a typical class, do I need to indicate that it implements the IDisposable interface and then create a Dispose method that implements the Dispose required by the IDisposable interface or can I just make a Sub Dispose() and the CLR will know that this is the Dispose method to call when the object falls out of scope? Thanks.
4
3334
by: phl | last post by:
hi, My question is: 1. To avoid possible memory leaks, when you use this pattern, after you have dealth with the unmanaged resources and before you take your object off the finalize queue, how are you sure that your managed object resources are completely freed up of resources it's might be using? In my case below I have a private bool variable. Are there any other managed resource that you might need to explicitly free up in
3
2455
by: dwaach | last post by:
Hi, I am thinking about implementing isInstanceOf() in c. Any ideas ??? Ex. int findType(struct x) { struct X orgX;
6
8517
by: Raj Wall | last post by:
Hi, I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary. My struct declaration has: public struct Ring : IEqualityComparer { .... } and I am trying to implement the Equals and GetHashCode methods.
5
3552
by: koonda | last post by:
Hi all, I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the...
4
2008
by: Ognjen Bezanov | last post by:
Hello All, I am a third year computer science student and I'm the process of selection for my final year project. One option that was thought up was the idea of implement my own version of the python interpreter (I'm referring to CPython here). Either as a process running on another OS or as a process running directly on the CPU. Now, I can't seem to find a decent source of information on the python
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.