B
B
beril2015-08-04 20:53:55
Programming
beril, 2015-08-04 20:53:55

Difference between class instance and C# class?

Can someone explain to me the difference between the concept of an instance of a class and the class as a whole.
A class and an object are different things, an instance of a class and an object are also different things?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2015-08-04
Protko @Fesor

an object is an instance of a class.

D
Denis, 2015-08-04
@prototype_denis

There is a class "Man".
And there is "Vasya Pupkin", which is an instance of the "Person" class.
And as Sergei Protko said , not every "Man" is "Vasya Pupkin".

S
Stanislav Makarov, 2015-08-05
@Nipheris

> a copy of a class and object leaves too different things?
Unfortunately, within the framework of modern terminology and taking into account the diversity of object models, it is difficult to answer your question unambiguously. I will say this: if you have a statically typed class language (class-based, i.e. C # / C ++ / Java), then every object is always an instance of a class, but in other languages ​​​​and object systems it may be different. To get a specific answer, you need to know exactly what language it is.
In general, there is a slight difference between the terms themselves: an object is primarily a black box with an identity and some well-known interface, and it’s not at all a fact that this object is “created according to a drawing”, as brainick said, however, if we consider classes as sets, then in many languages ​​there is the concept of a root class in the hierarchy (class object or "class of all objects"). Now, if such a concept exists, then we can say that any object is an instance of the object class.

I
Ilya Trifonov, 2015-08-06
@ilyatrifonov

I apologize for being off topic, but how can you even start OOP without knowing such elementary things. For me, it would be worth starting with books on C # in order to understand the basics of OOP and not ask such questions. And do not immediately run to program ... Once again I apologize.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question