collapse collapse

* Who's Online

  • Dot Guests: 76
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11163
  • stats Total Topics: 1699
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 248

Author Topic: C classes?  (Read 2796 times)

0 Members and 1 Guest are viewing this topic.

Offline isaro

  • Software Developer
  • Administrator
  • Sr. Member
  • *
  • Posts: 393
  • Reputation 505
  • Gender: Male
    • View Profile
C classes?
« on: March 13, 2009, 09:16:24 am »
Anyone know if you can make classes in C?

And if so can I please get an example of code.





0001 + 1000 = 1001

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: C classes?
« Reply #1 on: March 13, 2009, 11:16:14 am »
No, c does not support classes. If you want something similar, used structs.
Code: [Select]
struct sReplaceForClass
{
};

Used the same as a class, just no prive/pub/protected areas.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: C classes?
« Reply #2 on: March 13, 2009, 02:21:33 pm »
To addon to Celestialkey - structs can contain functions as well as data, however, everything will be public.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline isaro

  • Software Developer
  • Administrator
  • Sr. Member
  • *
  • Posts: 393
  • Reputation 505
  • Gender: Male
    • View Profile
Re: C classes?
« Reply #3 on: March 14, 2009, 12:01:09 am »
Hmm, I don't think I'd need any privates.

if so i can work around them.


Thanks for the struct info.
0001 + 1000 = 1001

 

Donate


* Search


* Recent Posts

Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]


Re: Client-Server Messaging by Nathan
[October 25, 2015, 05:48:57 pm]