C++ Programmer Question:
Download Job Interview Questions and Answers PDF
Tell me what is a class?
Answer:
Class defines a datatype, it's type definition of category of thing(s). But a class actually does not define the data, it just specifies the structure of data. To use them you need to create objects out of the class. Class can be considered as a blueprint of a building, you can not stay inside blueprint of building, you need to construct building(s) out of that plan. You can create any number of buildings from the blueprint, similarly you can create any number of objects from a class.
class Vehicle
{
public:
int numberOfTyres;
double engineCapacity;
void drive(){
// code to drive the car
}
};
class Vehicle
{
public:
int numberOfTyres;
double engineCapacity;
void drive(){
// code to drive the car
}
};
Download C++ Programmer Interview Questions And Answers
PDF
Previous Question | Next Question |
Tell me what are C++ inline functions? | Explain me which operator can be used in C++ to allocate dynamic memory? |