You are not logged in.

#1 2010-09-28 17:31:17

Baha
Member
Registered: 2008-09-07
Posts: 52

[Theory] A simple but hard question about OO programming

I was in my first class of OO programming (4th year of computer engineering in Valencia) and the professor gave us homework.

The homework was a simple question about OO programming (it is not about a specific language, though we are going to use Java in the practice sessions), we shall find an answer to it and discuss it in class the next day.

The question was:

"May classes also be objects?"

which can be said as:

"May classes be instances of an(other) classes?"

I hope that you, archers, can enlighten me in this question smile

Offline

#2 2010-09-28 17:52:52

tvale
Member
From: Portugal
Registered: 2008-12-11
Posts: 175

Re: [Theory] A simple but hard question about OO programming

I believe an object is an instance of a class.

Last edited by tvale (2010-09-28 17:53:35)

Offline

#3 2010-09-28 17:57:32

Texas
Member
From: Dallas, Texas
Registered: 2010-09-10
Posts: 131

Re: [Theory] A simple but hard question about OO programming

Agreed.

Offline

#4 2010-09-28 18:00:01

Baha
Member
Registered: 2008-09-07
Posts: 52

Re: [Theory] A simple but hard question about OO programming

tvale wrote:

I believe an object is an instance of a class.

Yup, that's true. Let's see... An object is an instance of a class, so we can have a lot of objects coming from one class.

We can say an object is not a class because it has a state (think about a light, it has a state: on or off, but a class light is not on/off, because in a class we just describe the behavior that class should have.

But what we're asking here is if a class can have a state. I think it may refer to static properties about the objects.

Offline

#5 2010-09-28 18:06:18

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Theory] A simple but hard question about OO programming

Baha, don't ask other people to do your homework. See the forum etiquette.

Closing.


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB