Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OOP Interview Question
Message
 
À
27/01/2006 09:57:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01090521
Message ID:
01090975
Vues:
7
Would you give anyone points for saying, yes but an class is an abstract way organizing variables and functions together? Behind the scenes it is functions, arrays, and variables with procedural code. For performance the solution dictate the simple use of an array. :-)

>I would be happy with all of them to be honest. It's just a question that I ask in the 1st interview. I'm not looking for a perfect answer just something that shows they know some OOP/OOAD.
>
>Most of the time when I ask the question people just look at me and say no they can't describ a deck of cards as an object. The ones that try usally talk about arrays and storing values in there to represent the cards.
>
>>
>>There are a number of ways to do this, depending on what you are going to do the the objects, or which kind of problem you will be solving. which of these would you consider a good response?
>>
>>SOLUTION 1:
>>- class called card
>>- card has two properities face (2-A) and suit
>>- to represent a card, instantiate the class into 52 objects then assign the face and suit
>>
>>SOLUTION 2:
>>- have a class called deck
>>- have class called card from solution 1, with the same properties
>>- have a method called create() on deck that creates a collection of card objects, 1 for each of the 52 cards
>>
>>SOLUTION 3:
>>- a class called card
>>- card has 4 methods, GetSuit(), SetSuit(), GetFace(), SetFace()
>>- have methods instead of properties, means that the object doesn't have to maintain state, which may be appropriate in some cases
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform