From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 00501BBCA for ; Tue, 26 Feb 2008 13:48:23 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJyYw0fAXQImh2dsb2JhbACQZAEBAQgKKZREhys X-IronPort-AV: E=Sophos;i="4.25,407,1199660400"; d="scan'208";a="23059454" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 26 Feb 2008 13:48:23 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1QCmNs9027206 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 26 Feb 2008 13:48:23 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAFqZw0fRVaK3kmdsb2JhbACQZAEBAQEHBAQJChaURIcv X-IronPort-AV: E=Sophos;i="4.25,407,1199660400"; d="scan'208";a="8602571" Received: from el-out-1112.google.com ([209.85.162.183]) by mail1-smtp-roc.national.inria.fr with ESMTP; 26 Feb 2008 13:48:22 +0100 Received: by el-out-1112.google.com with SMTP id m34so1948329ele.9 for ; Tue, 26 Feb 2008 04:48:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=E0j1g2x7wJGmFZjAWpUxz5tRwFTOg6M/TkB0nzdPfNc=; b=XM0E4ur++vUHqbbGneOOFrx6FnfJabDQPqZK0Dy9rbFHGV9b0dxCksPhQ9n2IALpZc4MyIHG2Yg1duBJ7VgAtiNIXGHi2oq8GYEogIbKk7psbjjag+sWawgMAGLcyINaUcB1DDYjKkaQxFYnb0Wxx/0fTVcl/PlCePlDxoPxJ4I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Gy/0oZpAFHhpwtBZG70fecFGwLQDg/vtOMwPxqUf9d8/k77erk8ppYkKtdVV7owYqUHfeSOoWCsZNh1SJj/IVXvCCk9gv5LXWmlml8Rgz7t+hr8PxSWH7KCdZRNtOXCyUcQRxNnaq/uBB7eAD4k21MPtx4wwp3cHB0357tmEYME= Received: by 10.114.125.2 with SMTP id x2mr5339534wac.119.1204030100381; Tue, 26 Feb 2008 04:48:20 -0800 (PST) Received: by 10.114.60.14 with HTTP; Tue, 26 Feb 2008 04:48:20 -0800 (PST) Message-ID: <6ebe51ce0802260448i61b968e4tf618edc0580636f5@mail.gmail.com> Date: Tue, 26 Feb 2008 13:48:20 +0100 From: ketti To: "Berke Durak" Subject: Re: [Caml-list] Objects, dynamic cast, Obj.magic abuse and dragons Cc: "Caml-list List" In-Reply-To: <47C3F96E.4080901@exalead.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47C3F96E.4080901@exalead.com> X-Miltered: at discorde with ID 47C40A97.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; berke:01 durak:01 berke:01 durak:01 hero:98 coffin:98 hero:98 encode:01 caml-list:01 inherit:01 inherit:01 interfaces:01 objects:02 objects:02 dynamic:03 Hi, 2008/2/26 Berke Durak : > Persons, places and objects are things so they inherit from physical. Hence, a forest is a place that can contain > a sword (an object), a dragon (a person) or another place (a small house). Persons can be contained in places > or things (coffins). > > The problem is that the main game loop gets the current location by taking the container of the hero... which is a > physical. However, it needs to call the place-specific method "go". I too have only read your code briefly, but i would suggest you use multiple inheritanse. Coffin would inherit from both object and place. That way the container of the hero is always a place. In fact, that is the way i would encode it in java too (using interfaces).