Return Styles: Pseud0ch, Terminal, Valhalla, Blue Moon.

Pages: 1-

HELP! Stuck in OOP course!

Name: Anonymous 2017-09-28 19:37

I'm stuck in a C++ data structures class

The teacher only teaches from an OOP perspective and teaches C++ as if it is C with a few bells and whistles. (not allowed to use vectors, STL, string, etc)

In the last C++ course I took, I was able to get away with writing all of my programs in C, to explicitly send a message to the teacher that I refuse to take the OOP pill. (And as a communist I am ideologically opposed to the use of classes)

However I worry that in this course, the teacher may rely on the problematic aspects of C++ more. Classes, public/private, all that

As someone who does know C kinda well and doesn't know C++ at all, what suggestions would you make for continue doing OOP data structures in C? Does /prog/ support me in my autistic crusade?

Name: Anonymous 2017-09-30 14:24

The teacher only teaches from an OOP perspective and teaches C++ as if it is C with a few bells and whistles. (not allowed to use vectors, STL, string, etc)
What? "C++ as a better C" means you specifically ignore the OOP features of C++ and use it instead as a strictly procedural language with the niceties of the C++ standard library.

what suggestions would you make for continue doing OOP data structures in C?
There are two basic requirements for "Object-oriented programming":

1. Data structures can inherit hierarchically.
2. Procedures/Functions/Methods/whatever support multiple dispatch.

If you want to have any of that in C, you're going to need to put class meta-information in your data structures at which point you might as well have just used C++. See chapter two of: https://www.cs.rit.edu/~ats/books/ooc.pdf. If you want to do OOP with a compiled, statically typed language, check out Nim or Crystal Lang.

Name: Anonymous 2017-09-30 14:51

If your teacher was good, they'd teach you C++ without templates

Name: Anonymous 2017-09-30 16:04

I once had data structures in C
You would need to define methods for their creation and destruction, though, just without classes.

Don't change these.
Name: Email:
Entire Thread Thread List