how to do in c, what is record and object in pascal?

This is a discussion on how to do in c, what is record and object in pascal? within the C Programming forums, part of the General Programming Boards category; Hello! I've searched a lot but i couldn't find how to create such struct wich has funtions in it. For ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    8

    how to do in c, what is record and object in pascal?

    Hello! I've searched a lot but i couldn't find how to create such struct wich has funtions in it. For example, struct called button has x,y,w and h. I can access these by button.x, button.y, etc. But how can i do a function in it, like button.draw();? In pascal these were called object's.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    You need C++ if you want to do stuff like that.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    8
    ported my app to c++ now (little rewrite and renaming c to cpp), how do i do it in c++?

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    By asking on the c++ forum Look into member functions

  5. #5
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Surely this can be done in C using pointers to functions?

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by Jez
    Surely this can be done in C using pointers to functions?
    It seams possible allthough it would be like re-inventing the wheal.

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    If you want to use OO design then use an OO language. Yes you can do OO in C and its a lot of fun if you are bored. But I definatly wouldn't recommend it for a new programmer.

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Quantum1024
    It seams possible allthough it would be like re-inventing the wheal.
    A wheal? Eeeew.

    Quzah.
    Hope is the first step on the road to disappointment.

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by quzah
    A wheal? Eeeew.

    Quzah.
    haha my bad.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copies made of object during push_back()
    By Sharke in forum C++ Programming
    Replies: 3
    Last Post: 06-08-2009, 02:15 AM
  2. Little Help?
    By bbb543 in forum C++ Programming
    Replies: 31
    Last Post: 10-25-2008, 10:18 AM
  3. OleDbCommand.ExecuteScalar return problems
    By qwertiop in forum C# Programming
    Replies: 8
    Last Post: 05-07-2006, 10:19 AM

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