Solved

oop

Posted on 1998-03-18
3
194 Views
Last Modified: 2013-12-14
Is c object oriented language or not? Can struct replace class? (I've used functions inside structures and it works)
0
Comment
Question by:jas_jan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
yonat earned 50 total points
ID: 1257760
C is not an object oriented language. It takes great effort and pain to implement object oriented designs in C (beleive me, I have done this).

A C struct cannot replace a C++ class. You will have to implement a complete virtual table mechanism in order to have anything close to polymorphism. Even then, you don't get access protection, and the whole thing is very difficult to write and maintain.

My recomendation: For object oriented programming, use an object oriented language (C++ or some other OOPL). It will make your life easier.
0
 

Author Comment

by:jas_jan
ID: 1257761
Yes, you can define objects in C. You can even do it in assembly language. To say that it requires "some extra effort" is a big understatement. It is *painful*. Not only for the programmer defining the objects, but also for the programmers using these object, and for the programmers who need to extend these objects.

C *enables* you to do anything, including objects. However, it does not *support* object oriented programming. OOPLs are languages that wither support (like C++) or enforce (like SmallTalk) OOP. So C isn't an OOPL.

BTW, I remember Apple had an OO library using C for QuickDraw GX. If you're interested, here's the URL: http://devworld.apple.com/ngs/lpp/adrpub/docs/dev/techsupport/insidemac/GXOverview/GXOverview-2.html
0
 
LVL 5

Expert Comment

by:yonat
ID: 1257762
Thank you yonat for your comments. Pl keep in touch.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question