GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C++

 Print  |  
Question:  
What is a class?


Answer: 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.
 


June 06, 2007 04:00:33 #8
 SomGollakota   Member Since: June 2007    Total Comments: 30 

RE: What is a class?
 
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).
     

 

Back To Question