Like Tree1Likes
  • 1 Post By oogabooga

Hi, about Class and Objects

This is a discussion on Hi, about Class and Objects within the C++ Programming forums, part of the General Programming Boards category; Hi, I have got a question, is it true that "Classes" that we use in C Program are replacement for ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    96

    Hi, about Class and Objects

    Hi,

    I have got a question, is it true that "Classes" that we use in C Program are replacement for "Structure"?

    Is their something wrong with "structure" that classes had to be introduced?

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    In C++, structs were extended to have member functions and access levels (private, protected, public), with a default access of public. The class construct, as far as I know, is just a kind of "syntactic sugar" for a struct that has default private access. So both struct and class define "classes", but programmers generally use struct for classes with public data members and class for classes with private data members.
    Elkvis likes this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 07-15-2010, 08:53 PM
  2. Array of class objects
    By te5la in forum C++ Programming
    Replies: 4
    Last Post: 07-23-2008, 06:37 PM
  3. Array of class objects
    By GCNDoug in forum C++ Programming
    Replies: 29
    Last Post: 03-26-2008, 05:30 PM
  4. Replies: 4
    Last Post: 10-16-2003, 12:26 PM
  5. base class pointer to derived class objects
    By curlious in forum C++ Programming
    Replies: 4
    Last Post: 09-28-2003, 09:39 PM

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