Like Tree1Likes

Simulating OOP with structs and function pointers?

This is a discussion on Simulating OOP with structs and function pointers? within the C Programming forums, part of the General Programming Boards category; Originally Posted by quzah Will a search-and-replace make the function a member of that object? Is that what you're saying ...

  1. #31
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    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.
    Riviera71 likes this.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  2. #32
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 3 of 3 FirstFirst 123
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, 06:14 PM
  3. Replies: 5
    Last Post: 02-20-2004, 08: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 Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21