Thread: Simulating OOP with structs and function pointers?

  1. #31
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR
    Quote Originally Posted by quzah View Post
    Will a search-and-replace make the function a member of that object? Is that what you're saying it does?
    I don't know why you impart some magical quality on the syntax a->b() such that this causes b() to be a "part of" a. b() being part of a is something conceived in the programmer's mind, not an artifact of the way it's written.

    That is how most people differentiate OO from procedural programming. The object has the functionality, versus the function takes objects. I don't know. To be honest, I never got the whole appeal of OOP. It just seems to me like it's an attempt to make sure people don't pass stupid things to functions.
    I don't think of it that way, at least. To me, OOP means polymorphism.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

  2. #32
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Quote Originally Posted by brewbuck
    To me, OOP means polymorphism.
    Yes, I regard OOP as the use of polymorphism through inheritance (as opposed to ad hoc polymorphism through function overloading and parametric polymorphism through some kind of template mechanism). The aspects of abstraction and encapsulation are certainly important aspects of OOP as well, but are not unique to OOP.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing pointers to structs as function arguments
    By Da-Nuka in forum C++ Programming
    Replies: 2
    Last Post: 06-13-2005, 12:10 PM
  2. passing structs & pointers to structs as arguments
    By Markallen85 in forum C Programming
    Replies: 6
    Last Post: 03-16-2004, 07:14 PM
  3. Replies: 5
    Last Post: 02-20-2004, 09:36 AM
  4. pointers to pointers within structs
    By Lord_azrael99 in forum C Programming
    Replies: 2
    Last Post: 08-28-2003, 04:29 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

Tags for this Thread