|
From: Luigi B. <lui...@gm...> - 2015-07-01 15:20:51
|
As I get old, I tend to rely less and less on inheritance. :) In this case, instead of creating a new Impl class with, say, a chineseNewYear() method and inherit calendar implementations from it, I would just write a free chineseNewYear() function and call it from whatever calendar implementations need it. I would do the same with easterMonday if it didn't break backwards compatibility... Luigi On Tue, Jun 30, 2015 at 10:39 AM BARONE RICCARDO < ric...@ba...> wrote: > Hi everyone, > > I'm working on Chinese calendar and I want to share with you some ideas > about it. > > I was thinking to create a derived class from Impl (like WesternImpl and > OrthodoxImpl) with few methods for the most popular holidays i.e. Chinese > New Year, Buddha's Birthday and Mid-Autumn Festival. > > > > Problems start when countries celebrate both Easter and lunisolar > holidays: all classes implement the virtual method isWeekend(Weekday). > > After thinking about it for a while, I came to the following different > conclusions: > > > > - Lazy way: copy in ChineseImpl the easterMonday method > > > > - Hard-working way: define Day easterMonday(Year y, string religion) as > public method of the class Calendar. In this way the existence of the old > classes WesternImpl and OrthodoxImpl doesn't have sense anymore and they > could be replaced by something like Gregorian, Chinese, Islamic and Hebrew. > > > > - Mark all the Impl derived classes (WesternImpl, OrthodoxImpl and > ChineseImpl) as virtual. This is the typical solution to the diamond > problem, but I'm not so proficient in C++ language to understand if it > makes sense and solves our problems. > > > > Any suggestions on how to proceed? > > > > Thanks > > Riccardo > > > Prima di stampare, pensa all'ambiente ** Think about the environment > before printing > > ------------------------------ > > This e-mail is subject to terms available at the following link: > http://www.bancaimi.com/bancaimi/email_disclaimer.html. > Please read the hyperlink carefully as it contains the conditions > governing any electronic communications between you and Banca IMI SpA. By > messaging with Banca IMI SpA you agree to such terms and conditions of use. > Banca IMI SpA may amend these terms and conditions at any time without > notice. You should check the relevant webpage from time to time to review > the current terms and conditions because they are binding on you. If you > received this transmission in error, please immediately contact the sender > and destroy the material in its entirety, whether in electronic or hard > copy format. Please note that, if you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or use of > the information contained herein (including any reliance thereon) is > strictly prohibited and may be unlawful. > > ------------------------------ > > Il presente messaggio, inclusi gli eventuali allegati, ha natura aziendale > e potrebbe contenere informazioni confidenziali e/o riservate. Chiunque lo > ricevesse per errore, è pregato di avvisare tempestivamente il mittente e > di cancellarlo. > E’ strettamente vietata qualsiasi forma di utilizzo, riproduzione o > diffusione non autorizzata del contenuto di questo messaggio o di parte di > esso. > Pur essendo state assunte le dovute precauzioni per ridurre al minimo il > rischio di trasmissione di virus, si suggerisce di effettuare gli opportuni > controlli sui documenti allegati al presente messaggio. Non si assume > alcuna responsabilità per eventuali danni o perdite derivanti dalla > presenza di virus. > > Per lo svolgimento delle attività di investimento nel Regno Unito, la > società è autorizzata da Banca d'Italia ed è soggetta alla vigilanza > limitata della Financial Conduct Authority ( FCA ) e della Prudential > Regulation Authority ( PRA ) . Maggiori informazioni in merito ai poteri di > vigilanza della Financial Conduct Authority ( FCA ) e della Prudential > Regulation Authority ( PRA ) sono a disposizione previa richiesta. > > Nel Regno Unito Intesa Sanpaolo S.p.A. opera attraverso la filiale di > Londra, sita in 90 Queen Street, London EC4N 1SA, registrata in Inghilterra > & Galles sotto No.FC016201, Branch No.BR000036 > > In osservanza dei requisito imposti dal Internal Revenue Service (Agenzia > delle Entrate degli Stati Uniti), qualunque discussione relativa a temi di > natura fiscale contenuta in questo messaggio o nei suoi allegati non e’ > intesa ne’ e’ stata scritta per essere utilizzata, ne’ puo’ essere > utilizata per (i) evitare l’imposizione di gravami fiscali secondo il > codice tributario vigente negli Stati Uniti o (ii) per promuovere, > sollecitare o raccomandare una operazione finanziaria o altra transazione > indirizzata ad un altro destinatario. > > Nella Repubblica d’Irlanda, Intesa Sanpaolo Bank Ireland plc è > regolamentata dalla Banca Centrale d’Irlanda ed è parte del Gruppo Bancario > Intesa Sanpaolo S.p.A. Registrata in Irlanda come società numero 125216 – > IVA Reg. IE4817418C IE, sita in, KBC House, 4 George Dock, IFSC, Dublino 1, > Irlanda. > > *** > > ------------------------------ > > This email (including any attachment) is a corporate message and may > contain confidential and/or privileged and/or proprietary information. If > you have received this email in error, please notify the sender > immediately, do not use or share it and destroy this email. Any > unauthorised use, copying or disclosure of the material in this email or of > parts hereof (including reliance thereon) is strictly forbidden. > We have taken precautions to minimize the risk of transmitting software > viruses but nevertheless advise you to carry out your own virus checks on > any attachment of this message. We accept no liability for loss or damage > caused by software viruses. > > For the conduct of investment business in the UK, the Company is > authorised by Banca d’Italia and subject to limited regulation in the UK by > the Financial Conduct Authority ( FCA ) and the Prudential Regulation > Authority ( PRA ). Details about the extent of our regulation by the > Financial Conduct Authority ( FCA ) and the Prudential Regulation Authority > ( PRA ) are available from us on request. > > In the UK Intesa Sanpaolo S.p.A. operates through its London Branch, > located at 90 Queen Street, London EC4N 1SA. Registered in England & Wales > under No.FC016201, Branch No.BR000036 > > To comply with requirements imposed by the IRS, we inform you that any > discussion of U.S. federal tax issues contained herein (including any > attachments) was not intended or written to be used, and cannot be used by > you, for the purpose of (i) avoiding penalties under the Internal Revenue > Code or (ii) promoting, marketing or recommending any transaction or matter > addressed herein to another party. > > In the Republic of Ireland, Intesa Sanpaolo Bank Ireland plc is regulated > by the Central Bank of Ireland and is a member of the Intesa Sanpaolo > Group. It is registered in Ireland as company no.125216 – VAT Reg. No. IE > 4817418C and located at, 3rd Floor, KBC House, 4 George’s Dock, IFSC, > Dublin 1, Ireland. > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > -- <http://leanpub.com/implementingquantlib/> <http://implementingquantlib.com> <http://twitter.com/lballabio> |