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

What else can I help you with?

Related Questions

What is long components in the C programming language?

A 32 bit integer.


Major advantage in cpp compared to c?

The major advantage of C++ over C is the Object Oriented Programming compatibility in C++.


What are the two major types of programming languages in c plus plus?

Object oriented programming and structured programming.


What are the three c plus plus programming language components?

The editor, compiler and linker.


Is the Acer Notebook 15 Suitable for programming?

Depending on what language you are programming it may or not run. However most of the major languages (C, VB, C++, C#) you should be able to run it.


What are major components of a c program?

mujhe kya pta


What are the major programming languages commonly used by organisations in Australia to build software applications?

C++,COBOL,Ruby,C*,JAVA


What is c and c in computer programming?

C and C++ are both high-level programming languages.


Create a spiral in C programming?

create spiral in c programming?


When was C - programming language - created?

C - programming language - was created in 1972.


What has the author Robert Lafore written?

Robert Lafore has written: 'Object-oriented programming in Microsoft C++' -- subject(s): Object-oriented programming (Computer science), C++ (Computer program language), C. 'Microsoft C. Programming for the I.B.M.Personal Computer' 'Object-oriented programming in C++' 'Windows Programming Made Ridiculously Easy Book' 'The Waite Group's C Programming Using Turbo C++ (The Waite Group)' 'Microsoft C programming for the IBM' 'The Waite Group's Microsoft C programming for the PC' -- subject(s): C (Computer program language), IBM microcomputers, Microsoft C (Computer program), Microsoft C., Programming


What is a C compiler as used in C programming?

In C programming, C compiler is user to translate C source into C object module.