How should I use classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How should I use classes

I understand what classes are but how and when should I use them? For example what classes might I have in a programme that has a login screen etc.

9th Jul 2016, 11:53 PM
Tony Rath
Tony Rath - avatar
1 Answer
+ 2
You can create class namely login,which attributes can be userid,password & methods like check availability of userid & password.. then what to do if password is wrong... you can create methods by your functionality requirements.. I jst want to say,"METHODS DECIDE ACTION ON DATA,& DATA IS NOTHING BUT ATTRIBUTE OF CLASS",So methods & data bind together & make an entity which we known as class.
10th Jul 2016, 3:54 AM
siddhpura Amit
siddhpura Amit - avatar