Sign up ×

Possible Duplicate:
Difference between object and instance

I have couple of questions:

  1. Every instance of a class (except an abstract class) is an object?
  2. Abstract classes cannot be instantiated, hence they are not objects?

Could anyone help me better understand the above concepts as they relate to C#?

share|improve this question

marked as duplicate by John Saunders, Cody Gray, slugster, pratap k, Brian Dec 18 '11 at 19:29


1. Yes (given #2) and 2. yes. One curve ball is static classes which are basically a single object for the lifetime of a process. – M.Babcock Dec 18 '11 at 6:08
It helps to think of abstract classes as equivalent to interfaces. They're just interfaces that can provide a default implementation. – Cody Gray Dec 18 '11 at 6:10
Related post -… – Yasser Apr 12 '14 at 14:50

6 Answers 6

up vote 19 down vote accepted
  1. An object is an instance of a class.

  2. A class is the definition of an object. It does not actually become an object until it is instantiated. Since an abstract class can't be instantiated, no object of that type can created. A sub class would need to be defined in order for an object to created.

share|improve this answer
  1. Yes, every instance of a class is an object.
  2. Classes (whether abstract or not) are not objects. They are types.
share|improve this answer
Even if abstract classes could be instantiated, they still wouldn't be objects. – David Schwartz Dec 18 '11 at 6:10
It should be noted that in some languages, classes are objects too. – marco-fiset Apr 16 '13 at 15:15

There is one common analogy to maybe clearer show what is the difference between the concepts of class and object.

A class is like a recipe. An object is a cake. From one recipe you can build many cakes. A recipe can only contain hints (be abstract) and leave room for your own creation of a recipe (implementing class) from which you can then build cakes (objects).

So a class is not an object, it's the description of what objects of that class look like. Abstract classes contain methods and other information useful for the implementation of classes deriving from this abstract class. Objects cannot be created/instantiated from an abstract class (because it's definition is not complete).

share|improve this answer
class Cat {} // It is a cat. Just a cat. Class is a general issue.

myCat = new Cat("red", "5kg", "likes a milk", "3 years old"); // It is my cat. It is a object. It is a really cat. 

yourCat = new Cat("gary", "3kg", "likes a meal", "5 years old"); // It is your cat. Another cat. Not my cat. It is a really cat too. It is an object;

abstract class Animal {} // Abstract class
animal = new Animal(); // It is not correct. What is 'animal'? Cat, dog, cow? I don't know.

class Dog : Animal {} // It is a class. It is a dog in general. 
someDog = new Dog("brown", "10 kg", "likes a cats"); // It is a really dog. It is an object.
share|improve this answer

An abstract class can never be instantiated (and so can never become an object). If you create class that inherits from an abstract base class, and instantiate it, it will have properties of the abstract class as well as its own properties. The objective behind creating an abstract base class is to "enforce" deriving classes to implement certain functionality (similar to an interface, but not quite).

share|improve this answer
Namely, an interface cannot have any implemented methods, but is just that: an interface. – Gravity Dec 30 '11 at 1:40


Yes. That's the definition of "instance.

Abstract classes cannot be instantiated, hence they are not objects?

Classes are not the same as instances or objects. An object is an instance of a class. Imagine a zoo simulation. An object is like a specific lion, whereas a class is more like a description of what a lion is. Abstract classes are descriptions of things that are too vague to make it reasonable to build something based on that description alone (e.g. "Animal"). That's why you can't instantiate them. Something like an Animal might be too vague for the program to request directly; instead, the program will only request more specific things like Lion, Tiger, or Mongoose.

share|improve this answer
