?
Solved

oop

Posted on 1998-03-18
3
Medium Priority
?
195 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

801 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