Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php on line 90

Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-recent-posts.php on line 942

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121
TechMasala - Technology Spice Rack » 2006 » March » 14

Archive for March 14, 2006

Object Vs Class

The first question I ask in any interview is what do you think is the difference between Object and Class. Most of the time I get the bookish answer that an object is an instance of class and class is a blueprint. Ofcourse the answer is right, but when I ask the candidate to forget about any programming language or technology and give me an example for a class and corresponding object from the real world, he/she most of the time tells me an example that always fits as example for class.

For example this is a common example that the candidates give. An example for a class would be Car and the corresponding object would be Maruti (an Indian car model). Think about this, how can Maruti be an instance of the Car class when Maruti by itself is a bluprint of a type of Car or in object oriented terms, Maruti inherits Car but is still a class. What really would be an object for the class car would be to really show a car that is running on the street or parked outside. Because that is real instance, that you can feel, get into and drive.

That’s Object Thinking foundation #1.


Deprecated: Function ereg_replace() is deprecated in /home/techmasa/public_html/wp-content/plugins/sociable/sociable.php on line 64
Blink this Object Vs Class at blinklist.com    Bookmark Object Vs Class at blogmarks    Bookmark Object Vs Class at del.icio.us    Digg Object Vs Class at Digg.com    Fark Object Vs Class at Fark.com    Bookmark Object Vs Class at Furl.net    Bookmark Object Vs Class at NewsVine    Bookmark Object Vs Class at reddit.com    Bookmark Object Vs Class at Simpy.com    Bookmark Object Vs Class at Spurl.net    Bookmark Object Vs Class with wists    Bookmark Object Vs Class at YahooMyWeb

Comments (1)      Cosmos


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.