2955 Views

what is class in programming? is it important to use


rashi bajaj 2nd Oct, 2018
Answers (4)
V dc 13th Apr, 2019

Hi Candidate,

What is a class?

In object-oriented programming, a class is a template definition of the method s and variable s in a particular kind of object. Thus, an object is a specific instance of a class; it contains real values instead of variables. The class is one of the defining ideas of object-oriented programing

Why do we use?

A Class is a construct that is used to create instances of itself. Members of a class can be fields and methods that enable an object of the class to maintain state and behavior respectively. ... Meaning, to have objects in object-oriented programing, you need to instantiate a class.

Hope it helps.

Sathak Goel 9th Apr, 2019

Hello Rashi,

The class is a concept of Object Oriented programming languages. In case you know C programing, a class is similar to a structure, but provides more features than that. It is very important as it reduces complexity, abstracts, and generalizes data to reduce the length of the code. But it is not mandatory to use it, most of the programs can be done without it, although they may become complex and lengthy

A structure provides you with a customized datatype, whereas class provides you with the functionality of not only declare a variable(known as object) of customized datatype but also generalize functions for objects of that class. 

In simple words I can explain you like:(I assume you have a little bit of programming knowledge)

Consider a memory location, you declare it as integer and assigning some name(variable name) will provide you with a variable for storing 4/8 bit data. Now if you want another similar variable you declare another variable of the same datatype. But you might have heard about arrays, they reduce your code lines and provide you with a similar concept. 

Now suppose one variable is integer while other is a string(name, word)- now you will declare two variables of different data types, but a structure allows you to, compact this process, letting you create a custom datatype. Similarly, a class will also provide you create specific functions, limited to that class only such as printing those only.

Hope this helps,

Regards.

Tejendra Saraswat 4th Apr, 2019

Hello Rashi,

Class is way to bind the data  and its associated function together.It allows 

the data (and Function) to be hidden,if necessary from external use.

Clsses are  one of the key characterstics in Object Oriented Programming like-C++.

Thank You.

Hope it was helpful.



Shruti Soni 2nd Oct, 2018

Class is like a Blueprint. Which contains object in it. 

Classes are one of the key characteristics of an Object Oriented languange. A class contains methods and variables. 

Related Questions

Amity University-Noida B.Tech...
Apply
Among top 100 Universities Globally in the Times Higher Education (THE) Interdisciplinary Science Rankings 2026
KIET MBA Admissions 2026
Apply
Affiliated to AKTU | Approved by AICTE | Accredited by NAAC A+ | Rs. 48.89 LPA Highest CTC | Microsoft, Samsung, Infosys, Adobe, Amazon | NIRF-2023...
Amity University-Noida MBA Ad...
Apply
Ranked among top 10 B-Schools in India by multiple publications | Top Recruiters-Google, MicKinsey, Amazon, BCG & many more.
Narayana Business School MBA/...
Apply
Top 30 Private B-Schools Nationally and Top 3 in Gujarat | Highest CTC- 20 LPA | Average CTC- 8.4 LPA | 40% Pre-Placement Offers | 670+ Recruiters 
Amity University | M.Tech Adm...
Apply
Asia’s only university to be awarded the highest accreditation by WASC, USA and by the Quality Assurance Agency for Higher Education (QAA), UK
PML SD Business School PGDM A...
Apply
Offers 2-year full-time PGDM Programme | AICTE Approved | Accepting Exam Scores: CAT, MAT, CMAT, ATMA, GMAT & XAT
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books