220 38614 <bebc25db-8a70-4f45-9694-f5e517dccbce@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: new feature: declare data that replaces the
 previous one, or similar situation....
Date: Tue, 12 Jun 2018 00:28:30 -0700 (PDT)
Lines: 127
Approved: news@gmane.org
Message-ID: <bebc25db-8a70-4f45-9694-f5e517dccbce@isocpp.org>
References: <adc40bab-d824-440b-99b9-dab0ad6bd482@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_97792_254518234.1528788510279"
X-Trace: blaine.gmane.org 1528788386 9631 195.159.176.226 (12 Jun 2018 07:26:26 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 12 Jun 2018 07:26:26 +0000 (UTC)
Cc: rmbeer2@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRBH7M7XMAKGQEW6REB4Q@isocpp.org Tue Jun 12 09:26:22 2018
Return-path: <std-proposals+bncBCUJ3A7GRAPRBH7M7XMAKGQEW6REB4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRBH7M7XMAKGQEW6REB4Q@isocpp.org>)
	id 1fSdh7-0002Mv-7z
	for gclcip-std-proposals@m.gmane.org; Tue, 12 Jun 2018 09:26:21 +0200
Original-Received: by mail-yw0-f198.google.com with SMTP id l125-v6sf21118480ywc.15
        for <gclcip-std-proposals@m.gmane.org>; Tue, 12 Jun 2018 00:28:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=94L7UkyJjdy/f6Z9ItFv0dGtVQvqIP4ubogHLlRUh/0=;
        b=Vj0c1xfw67iFwgqjbIWTMHYnfaBfnG9CCtzHxauSM+Iah6vujOvbfOX/HhFSdAXqnC
         mKdf+x12nytQl57k3+0RBKm5Sd9iepk9U+EIA6Gy2P+h1eXX+0F1LvqfVEoLvQqrX3ro
         /V3zvyVov7usIurRu6jZscNkGaBTIEw65vhA+qoNfGMC8GVn++yjZ8jN3Ko0nFgT3BM6
         yk/XDm6UV8OiYPGse5WO/feWDmQDTAzM+bYsoeFyO2A2GMq+5hC2SeWP35Q/mWWA3n1o
         HXh5qBPR5V9czPIeg7BojBvt8RdYxoYTov9IqXuNCZ4p8SdthcxGs3m7jS8ECWAjI+JE
         aKjw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=94L7UkyJjdy/f6Z9ItFv0dGtVQvqIP4ubogHLlRUh/0=;
        b=I7ebzS88Bijx+uhTCs4CFG2tz46DQKdOdTHBMkZRaTDjyJTTJ12n3+kbTAoTU05pYg
         Zu5/kGlES8H3EF7lxyqllCHqFANSTFxcqm7Jn3pcJxoezqD6PycrsU+qMy6kaFyReFxU
         7etaMQsvu7qI4H6XhRMFGyMpXpPX+Q6HKig1Cqtweku3gt40C+0UDPXSja46NkrUJU78
         TeecLVQo4pNTmUoXH+ufydfnAYg54k4GWiexKvJDC2Shsz0fbtd4ix5ioTdK74kymOjq
         e3NAOSxxwvG0/uWmIWNnESPl/XPkMJahhjW1wQZvNaCEjSF3dfIy3FBfyykr6Gbxacg1
         PfCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=94L7UkyJjdy/f6Z9ItFv0dGtVQvqIP4ubogHLlRUh/0=;
        b=Ws67S6EX4+/bzZG88t/tgOplhf54XYFptSBNnyql/W9OwsphKTtXcHjIMXZ63Rxs08
         6FbxbmW/j/lZv6t4Pe9r6kCZrijXrlxW3xt7IKIUrZ5Mzv4ZqA+I/LPzTiIEaK75vsHF
         qZIhb7IYrM8s/lL16EZYN9SlB5M1Y0doca5MFUnFDBUeehQba44HGCDVJv5cEI9Lu0uz
         9DpYYbjBI8tbzhcwbaejDjh5CXv3/cs0K+WMEmB/7UeR9wAiWEPgt06RvZUVPnDRF+qu
         6kGn/8HgBy98/3Gq/AOVYTC5mnlfwI84V8q6TJpsy8oRQJDJVn33VnODdL7ZIQq7dAKD
         7Hig==
X-Gm-Message-State: APt69E3FMfFSYvevWeXdnHJJkvwOjOqkp8hRpktB+qMKUKVI47sV0DQl
	ScMQC7vjFg5ACnAA9RHe9bvXRQ==
X-Google-Smtp-Source: ADUXVKJckBk9SR0KUieDwRNkFeP6tPnJCuhyjyubp22iKR3bMLSqD8rXbbwafF6UiEl4mYj4b1ItYA==
X-Received: by 2002:a25:d4b:: with SMTP id 72-v6mr6287766ybn.55.1528788512135;
        Tue, 12 Jun 2018 00:28:32 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:7354:: with SMTP id o81-v6ls133540ywc.18.gmail; Tue, 12
 Jun 2018 00:28:31 -0700 (PDT)
X-Received: by 2002:a81:3487:: with SMTP id b129-v6mr1330691ywa.13.1528788510996;
        Tue, 12 Jun 2018 00:28:30 -0700 (PDT)
In-Reply-To: <adc40bab-d824-440b-99b9-dab0ad6bd482@isocpp.org>
X-Original-Sender: MihailNajdenov@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:38614
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38614>

------=_Part_97792_254518234.1528788510279
Content-Type: multipart/alternative; 
	boundary="----=_Part_97793_1441088912.1528788510279"

------=_Part_97793_1441088912.1528788510279
Content-Type: text/plain; charset="UTF-8"

*Solution 2*


template<class T>
class B {
public:
    B(int i=1) : a(i) { }
    void f2() {
        std::cout << "A:" << a.z << std::endl;
    }
//    virtual A a; // Use A only from B
    T a;
};
class D : public B<C> {
public:
    D() : B<C>(3) { }
    void f2(){
        std::cout << "C+A:" << a.z << std::endl;
        B::f2();
    }
//    virtual C a; // Use C+A only from D
};


*Solution 3*


class B 
{
public:
  B(A* a_) : a(a_) { }
  B() : a(new A(1)) { }
  void f2() {
   std::cout << "A:" << a->z << std::endl;
  }
// virtual A a; // Use A only from B
    std::unique_ptr<A> a;
};

class D : public B 
{
public:
  D() : B(new C(3)) { }
  void f2(){
    std::cout << "C+A:" << a->z << std::endl;
    B::f2();
  }
// virtual C a; // Use C+A only from D
};


*Solution 4*

Develop in terms of interfaces only


-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/bebc25db-8a70-4f45-9694-f5e517dccbce%40isocpp.org.

------=_Part_97793_1441088912.1528788510279
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><b><font face=3D"arial,sans-serif">Solution 2</font><=
/b></div><div><font face=3D"courier new,monospace"><b></b><font face=3D"ari=
al,sans-serif"></font><br></font></div><div><font face=3D"courier new,monos=
pace"><br>template&lt;class T&gt;<br>class B {<br>public:<br>=C2=A0=C2=A0=
=C2=A0 B(int i=3D1) : a(i) { }<br>=C2=A0=C2=A0=C2=A0 void f2() {<br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 std::cout &lt;&lt; &quot;A:&quot; &lt;=
&lt; a.z &lt;&lt; std::endl;<br>=C2=A0=C2=A0=C2=A0 }<br>//=C2=A0=C2=A0=C2=
=A0 virtual A a; // Use A only from B<br>=C2=A0=C2=A0=C2=A0 T a;<br>};</fon=
t></div><div><font face=3D"courier new,monospace">class D : public B&lt;C&g=
t; {<br>public:<br>=C2=A0=C2=A0=C2=A0 D() : B&lt;C&gt;(3) { }<br>=C2=A0=C2=
=A0=C2=A0 void f2(){<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 std::cou=
t &lt;&lt; &quot;C+A:&quot; &lt;&lt; a.z &lt;&lt; std::endl;<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 B::f2();<br>=C2=A0=C2=A0=C2=A0 }<br>//=C2=
=A0=C2=A0=C2=A0 virtual C a; // Use C+A only from D<br>};</font></div><div>=
<font face=3D"courier new,monospace"><br></font></div><div><font face=3D"ar=
ial,sans-serif"></font><b></b><br></div><div><font face=3D"arial,sans-serif=
"><b>Solution 3</b></font></div><div><font face=3D"courier new,monospace"><=
br></font></div><font face=3D"courier new,monospace"><br><div>class B=C2=A0=
</div><div>{<br></div>public:<br>=C2=A0 B(A* a_) : a(a_) { }<br>=C2=A0 B() =
: a(new A(1)) { }<br>=C2=A0 void f2() {<br>=C2=A0=C2=A0 std::cout &lt;&lt; =
&quot;A:&quot; &lt;&lt; a-&gt;z &lt;&lt; std::endl;<br>=C2=A0 }<br>//    vi=
rtual A a; // Use A only from B<br>=C2=A0 =C2=A0 std::unique_ptr&lt;A&gt; a=
;<br><div>};</div><div><br></div><div>class D : public B=C2=A0</div><div>{<=
br></div>public:<br>=C2=A0 D() : B(new C(3)) { }<br>=C2=A0 void f2(){<br>=
=C2=A0 =C2=A0 std::cout &lt;&lt; &quot;C+A:&quot; &lt;&lt; a-&gt;z &lt;&lt;=
 std::endl;<br>=C2=A0 =C2=A0 B::f2();<br>=C2=A0 }<br>//    virtual C a; // =
Use C+A only from D<br>};</font><div><font face=3D"arial,sans-serif"><b><br=
></b></font></div><div><font face=3D"arial,sans-serif"><b><br></b></font></=
div><div><font face=3D"arial,sans-serif"><b>Solution 4</b></font></div><div=
><font face=3D"courier new,monospace"><font face=3D"arial,sans-serif"></fon=
t><b></b><br></font></div><div><font face=3D"arial,sans-serif">Develop in t=
erms of interfaces only</font></div><div><font face=3D"arial,sans-serif"><b=
r></font></div><div><font face=3D"arial,sans-serif"></font><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/bebc25db-8a70-4f45-9694-f5e517dccbce%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bebc25db-8a70-4f45-9694-f5e517dccbce=
%40isocpp.org</a>.<br />

------=_Part_97793_1441088912.1528788510279--

------=_Part_97792_254518234.1528788510279--

.
