What is a class?

Answer Posted / abalonesoft

A class defines a data type, much like a struct would be in
C. In a computer science sense, a type consists of both a
set of states and a set of operations which transition
between those states. Thus int is a type because it has both
a set of states and it has operations like i + j or i++,
etc. In exactly the same way, a class provides a set of
(usually public) operations, and a set of (usually
non-public) data bits representing the abstract values that
instances of the type can have.

You can imagine that int is a class that has member
functions called operator++, etc. (int isn't really a class,
but the basic analogy is this: a class is a type, much like
int is a type.)

Note: a C programmer can think of a class as a C struct
whose members default to private. But if that's all you
think of a class, then you probably need to experience a
personal paradigm shift.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2337


What is the best way to store flag values in a program?

580


What is static volatile in c?

576


What will be the outcome of the following conditional statement if the value of variable s is 10?

767


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

780






can any one provide me the notes of data structure for ignou cs-62 paper

1706


What are the applications of c language?

626


What is c preprocessor mean?

795


What are predefined functions in c?

568


When is a void pointer used?

678


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1777


What is enumerated data type in c?

627


What is unsigned int in c?

560


What is wild pointer in c?

609


What is sizeof in c?

571