A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FClass%2Finitialization_syntax</id>
		<title>C++ Tutorial/Class/initialization syntax - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FClass%2Finitialization_syntax"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Class/initialization_syntax&amp;action=history"/>
		<updated>2026-04-10T21:53:03Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Class/initialization_syntax&amp;diff=2327&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Class/initialization_syntax&amp;diff=2327&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Class/initialization_syntax&amp;diff=2328&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Class/initialization_syntax&amp;diff=2328&amp;oldid=prev"/>
				<updated>2010-05-25T10:29:28Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Initialize numA and numB inside the MyClass constructor using normal syntax==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;  &lt;br /&gt;
using namespace std;  &lt;br /&gt;
  &lt;br /&gt;
class MyClass {  &lt;br /&gt;
  int numA;  &lt;br /&gt;
  int numB;  &lt;br /&gt;
public:  &lt;br /&gt;
  MyClass(int x, int y) {  &lt;br /&gt;
    numA = x;  &lt;br /&gt;
    numB = y;  &lt;br /&gt;
  }  &lt;br /&gt;
  &lt;br /&gt;
  int getNumA() { return numA; }  &lt;br /&gt;
  int getNumB() { return numB; }  &lt;br /&gt;
};  &lt;br /&gt;
  &lt;br /&gt;
int main()  &lt;br /&gt;
{  &lt;br /&gt;
  MyClass ob1(7, 9), ob2(5, 2);  &lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Values in ob1 are &amp;quot; &amp;lt;&amp;lt; ob1.getNumB() &amp;lt;&amp;lt; &lt;br /&gt;
          &amp;quot; and &amp;quot; &amp;lt;&amp;lt; ob1.getNumA() &amp;lt;&amp;lt; endl;  &lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Values in ob2 are &amp;quot; &amp;lt;&amp;lt; ob2.getNumB() &amp;lt;&amp;lt; &lt;br /&gt;
          &amp;quot; and &amp;quot; &amp;lt;&amp;lt; ob2.getNumA() &amp;lt;&amp;lt; endl; &lt;br /&gt;
   &lt;br /&gt;
  return 0;  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Values in ob1 are 9 and 7&lt;br /&gt;
Values in ob2 are 2 and 5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Initialize parameters in base class==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
class Pointer&lt;br /&gt;
{&lt;br /&gt;
private:&lt;br /&gt;
       long x,y;&lt;br /&gt;
public:&lt;br /&gt;
       Pointer(long a=0,long b=0) { &lt;br /&gt;
           x=a;&lt;br /&gt;
           y=b;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
       long GetX(){ &lt;br /&gt;
           return x;&lt;br /&gt;
    }&lt;br /&gt;
       long GetY(){ &lt;br /&gt;
           return y;&lt;br /&gt;
    }&lt;br /&gt;
       void Disp(){ &lt;br /&gt;
           cout &amp;lt;&amp;lt; &amp;quot;x=&amp;quot; &amp;lt;&amp;lt;x&amp;lt;&amp;lt;&amp;quot;  y=&amp;quot;&amp;lt;&amp;lt;y;&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
class Pointer3D : public Pointer&lt;br /&gt;
{&lt;br /&gt;
       long z;&lt;br /&gt;
public:&lt;br /&gt;
       Pointer3D(long a=0,long b=0,long c=0):Pointer(a,b){&lt;br /&gt;
           z=c;&lt;br /&gt;
       }&lt;br /&gt;
       long GetZ(){ return z;}&lt;br /&gt;
       &lt;br /&gt;
       void Disp()&lt;br /&gt;
       {&lt;br /&gt;
               cout &amp;lt;&amp;lt;&amp;quot;x= &amp;quot;&amp;lt;&amp;lt;GetX()&amp;lt;&amp;lt;&amp;quot;  y=&amp;quot;&amp;lt;&amp;lt;GetY();&lt;br /&gt;
               cout &amp;lt;&amp;lt; &amp;quot;  z=&amp;quot;&amp;lt;&amp;lt; z &amp;lt;&amp;lt;endl;&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
   Pointer3D p1;&lt;br /&gt;
   Pointer3D p2(3,-4);&lt;br /&gt;
   p2.Disp();&lt;br /&gt;
   p2=p1;&lt;br /&gt;
   p2.Disp();&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;x= 3  y=-4  z=0&lt;br /&gt;
x= 0  y=0  z=0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Initialize variables from base class using initialization syntax==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;  &lt;br /&gt;
using namespace std;  &lt;br /&gt;
  &lt;br /&gt;
class MyClass {  &lt;br /&gt;
  const int numA; // const member &lt;br /&gt;
  const int numB; // const member &lt;br /&gt;
public:  &lt;br /&gt;
   &lt;br /&gt;
  MyClass(int x, int y) : numA(x), numB(y) { }  &lt;br /&gt;
  &lt;br /&gt;
  int getNumA() { return numA; }  &lt;br /&gt;
  int getNumB() { return numB; }  &lt;br /&gt;
};  &lt;br /&gt;
  &lt;br /&gt;
int main()  &lt;br /&gt;
{  &lt;br /&gt;
  MyClass ob1(7, 9), ob2(5, 2);  &lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Values in ob1 are &amp;quot; &amp;lt;&amp;lt; ob1.getNumB() &amp;lt;&amp;lt; &lt;br /&gt;
          &amp;quot; and &amp;quot; &amp;lt;&amp;lt; ob1.getNumA() &amp;lt;&amp;lt; endl;  &lt;br /&gt;
  &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Values in ob2 are &amp;quot; &amp;lt;&amp;lt; ob2.getNumB() &amp;lt;&amp;lt; &lt;br /&gt;
          &amp;quot; and &amp;quot; &amp;lt;&amp;lt; ob2.getNumA() &amp;lt;&amp;lt; endl; &lt;br /&gt;
   &lt;br /&gt;
  return 0;  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Values in ob1 are 9 and 7&lt;br /&gt;
Values in ob2 are 2 and 5&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>