answersLogoWhite

0

The major components of a class are its members (data and methods) and its interface to those members. All classes have four members by default: the default constructor, the copy constructor, the destructor, and the assignment operator. However, if you declare any constructor (including a copy constructor) you lose the default constructor unless you declare your own. The class interface is defined by the public, protected and private sections of the class declaration. The interface may also be extended via friend classes and friend functions. Public and protected interfaces can also be inherited from existing base classes and/or abstract base classes to create derived classes, which may modify the base class interfaces without altering the base class itself. Private members can never be inherited, however.

The interface can be divided into several key components: construction, destruction, operations, attributes, accessors and mutators. Constructors handle the complete initialisation of the class and every constructor must ensure that a valid object exists whenever an object of the class is instantiated. The destructor is purely responsible for cleaning up any dynamic memory allocated on the heap and owned by the class (memory allocated on the stack is always released automatically). Operations include the assignment operator and any other operator overloads that modify the class in some way, such as the prefix increment operator. Attributes include type-casts and boolean operators such as the equality and greater-than operators, plus any member methods that return information about the class. Accessors return specific member values from the class (getters) while mutators modify those same members (setters).

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
RossRoss
Every question is just a happy little opportunity.
Chat with Ross
BeauBeau
You're doing better than you think!
Chat with Beau
More answers

The basic structure of a C++ program consists of primitive variables and constants, classes to encapsulate data and to operate upon that data, and external functions to manipulate the variables and objects instantiated from those classes. The minimum requirement of any C++ program is the same as for C: a main function.

User Avatar

Wiki User

11y ago
User Avatar

The simple answer is C, classes and objects. The components of C are data types and functions. A class combines data with the functions that operate upon that data, while an object is an instance of a class.

User Avatar

Wiki User

10y ago
User Avatar

The basic components are the primitive data types (int, char, float, etc) and the built-in functions that use those primitives. Both form the building blocks for user-defined data types and user-defined functions.

User Avatar

Wiki User

12y ago
User Avatar

The major components in C are functions and data structures. Each source file (including its headers) is a "translation unit". The C compiler can only translate one translation unit at a time, thus each unit must be entirely self-contained. Once all units are translated into object files, the linker uses the information provided by the compiler to link the object code to produce an executable.

User Avatar

Wiki User

7y ago
User Avatar

The main components of C++ are keywords, the intrinsic types (integrals and floating point types), enums, functions and classes such as the standard template library (STL).

User Avatar

Wiki User

11y ago
User Avatar

Template-metaprogramming (generic programming), object-oriented programming and procedural programming are the principal features.

User Avatar

Wiki User

8y ago
User Avatar

Editor, compiler and linker.

User Avatar

Wiki User

11y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What is the major components of c programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp