What is a class?

Class is a user-defined data type in C++. It can be created to solve a particular kind of problem. After creation the user need not know the specifics of the working of a class.


Editorial / Best Answer

Answered by: hirma

  • Sep 18th, 2005

class is a userdefined datatype which consists of attributes(datamembers) and behavior(member functions).Bydefault the members of a class is private.

Showing Answers 1 - 17 of 17 Answers


  • Jun 28th, 2005

class is a user defined data type,in which data members and member functions are defined.


  • Sep 18th, 2005

class is a userdefined datatype which consists of attributes(datamembers) and behavior(member functions).Bydefault the members of a class is private.


  • Oct 11th, 2005

Class is combination of member variables and member functions

  Was this answer useful?  Yes


  • Dec 16th, 2005

Class is a User Defined Data Type....it encapsulate both data and functions.Real time Example: Car is a class....under which we have different types, which is called a object interms of OOP.Software Ex: if i declare variable , say int a; .....here " int " is CLASS. and " a " is obeject of int class.

  Was this answer useful?  Yes


  • May 21st, 2006

class is such a bhosdaap which i can never understand whatz the need of this new feature instead of allowing a structure some more functionality.

  Was this answer useful?  Yes


  • Mar 22nd, 2007

Class is a data structure which is used to store variables and functions together. For example House is a class which consists of several components like the Bathroom,Dining hall,kitchen and etc


  • Apr 30th, 2007

A class is a user defined data type. A class is a collection of objects of similar type
Ex: Consider Bird class. Parrot, Sparrow, Peacock are the members of Bird class.

  Was this answer useful?  Yes

A class is a user-defined data type that encapsulates data and methods that can act upon the data together.

A class can also be defined as a classification/category of objects that have similar attributes and behaviour. For example, Automobile is a category of objects that have similar attributes, such as wheels, engine, doors, shape, color, cylinders etc., and behaviours, such as start, run, move, turn etc. Car is an instance of automobile which has different values for the attributes (4 wheels, one engine, 2 or 4 doors, 4/6/8 cylinders, etc), whereas, a semi-truck is another instance of automobile that has different values for the same attributes (18 wheels, one engine, two doors and so forth).


  • Aug 8th, 2007

A class is a User Defined Datatype which acts as a Model. Means we can create objects with that Class(model). Its a collection of datamembers and Memberfunction.

  Was this answer useful?  Yes

ajish babu

  • Jul 7th, 2008


Class is a data type .Class is a blue print of objects. Class gives an opportunity to define his on class according to his problem rather than using existing data type like float, char e.t.c.

  Was this answer useful?  Yes

CLASS Specifies the criteria to handle  the instance of the problem.The entire set of data and methods associated with the problem can be bound together and implemented as type with the help of class.

  Was this answer useful?  Yes


  • Jun 14th, 2009

A class is an expanded concept of a structure. Instead of holding data it can hold both data and functions.

  Was this answer useful?  Yes

In C, we can use only inbuilt data types for program needs but from C++ we can create userdefined datatypes in form of classes. Classes wrap datamembers and member functions that operate on datamembers together.

  Was this answer useful?  Yes


  • Dec 18th, 2017

Class is same as structure in C, but in Class we have functions

  Was this answer useful?  Yes


  • Jan 23rd, 2018

Class is a user define data type which contains the variable and function which r of two type private and public where the public class members can be accessed from any other class but the private class members can only accessed by there own class itself no other class can call that members of the class directly.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions