2908 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

UPES Integrated LLB Admission...
Apply
Ranked #28 amongst Institutions in India by NIRF | Ranked #1 in India for Academic Reputation by QS University Rankings | 16.6 LPA Highest CTC
Jindal Global Law School Admi...
Apply
Ranked #1 Law School in India & South Asia by QS- World University Rankings | Merit cum means scholarships
Symbiosis Law School Pune Adm...
Apply
NAAC A++ Accredited | Ranked #5 by NIRF
Nirma University Law Admissio...
Apply
Grade 'A+' accredited by NAAC
Great Lakes PGPM & PGDM 2025
Apply
Admissions Open | Globally Recognized by AACSB (US) & AMBA (UK) | 17.3 LPA Avg. CTC for PGPM 2024 | Application Deadline: 1st Dec 2024
ICFAI Business School-IBSAT 2024
Apply
9 IBS Campuses | Scholarships Worth Rs 10 CR
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