0
What is use of class in C++
why we use class in C++
2 Answers
+ 1
Hey priyanshu and other ,
In the world of object - oriented programming , we often want our types to not only hold data, provide function that work with the data as well. in c++ , this is typically done via the class keyword. using the class keyword defines a new user defined type called a class
in c++, classes are very Much like data only struct, except classes provided much powerful and flexibility. in fact, the following struct and class are effectively identical:
struct Data
{
int year ;
int month;
int day;
};
class Data
{
public:
int m_year;
int m_month;
int m_day;
};
The only significant difference is Access specifier such as
public
protect
private
0
thanks



