Class and Object
Definition of Class
: Class is definition of object.
Usage of Class
: Class is used for creating object.
Class
Object
Product blueprint
Product
(Metaphor)붕어빵 기계
붕어빵
Components of Object : Properties and Function
Object = Property(Variable) + Function(Method)
class Tv {
//Variable(=>Property)
String color;
boolean power;
int channel;
//Method(=>Function)
void power() {power = !power;}
void channelUp() {channel++;}
void channelDown() {channel--;}
}
Object and Instance
Object : Representative general terms of every Instance.
Instance : Created Object which is from specific Class.
Class ->(Instance화)->Instance(Object)
Summary
Why need Class? To create Object.
Why need Object? To use Object.
What does using Object mean? To use properties and function of Object.
Last updated
Was this helpful?