<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments for DreamCode</title>
	<atom:link href="http://www.dreamcode.org/blog/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dreamcode.org/blog</link>
	<description></description>
	<pubDate>Wed, 07 Jan 2009 18:35:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Java 中子类是否只继承父类的非私有变量和方法？ by Patrick</title>
		<link>http://www.dreamcode.org/blog/posts/8.html/comment-page-1#comment-6</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Sat, 20 Sep 2008 10:38:32 +0000</pubDate>
		<guid isPermaLink="false">http://sd.patrickhe.info/blog/?p=7#comment-6</guid>
		<description>1、因为子类和父类中都有 name 属性，所以子类中的 name 会隐藏掉父类中的同名属性。
2、getInfo() 会优先从“最近的地方”寻找名为 age 的属性，因为 getInfo() 在 Person 类中定义的，所以 getInfo() 会返回 Person 中的 age 的值。实际上，在 Student 的实例 s 中，存在一个 Person.age 和一个 Student.age。</description>
		<content:encoded><![CDATA[<p>1、因为子类和父类中都有 name 属性，所以子类中的 name 会隐藏掉父类中的同名属性。<br />
2、getInfo() 会优先从“最近的地方”寻找名为 age 的属性，因为 getInfo() 在 Person 类中定义的，所以 getInfo() 会返回 Person 中的 age 的值。实际上，在 Student 的实例 s 中，存在一个 Person.age 和一个 Student.age。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java 中子类是否只继承父类的非私有变量和方法？ by 于彬</title>
		<link>http://www.dreamcode.org/blog/posts/8.html/comment-page-1#comment-5</link>
		<dc:creator>于彬</dc:creator>
		<pubDate>Sat, 20 Sep 2008 10:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://sd.patrickhe.info/blog/?p=7#comment-5</guid>
		<description>您好 看到了您的文章有点感悟，我写了一段代码，好像和你说的有一些冲突，能帮我解答下吗 谢谢了
class Person
{   String name;
     private int age=30;
     public void setAge(int age)
	{this.age = age ;}
     public void setName(String name)
	{ this.name = name ; }
     public  int getAge ()
                 { return this.age;}
     public  String getName ()
                { return this.name;}
     public int getInfo()
               {  return this.age; }
}

class Student extends Person
{               int age =20;             
	 String name="你好";
	 public void print()
		 
	 {     System.out.println(this.name); 
	       System.out.println(super.name);
	       System.out.println(this.age);    
		   System.out.println(this.getInfo()); 
	 }
}

public class Demo03

{ public static void main(String[] args)  
     {
           Student s = new Student();    
           s.print();     
     }
}
结果
你好
null
20
30</description>
		<content:encoded><![CDATA[<p>您好 看到了您的文章有点感悟，我写了一段代码，好像和你说的有一些冲突，能帮我解答下吗 谢谢了<br />
class Person<br />
{   String name;<br />
     private int age=30;<br />
     public void setAge(int age)<br />
	{this.age = age ;}<br />
     public void setName(String name)<br />
	{ this.name = name ; }<br />
     public  int getAge ()<br />
                 { return this.age;}<br />
     public  String getName ()<br />
                { return this.name;}<br />
     public int getInfo()<br />
               {  return this.age; }<br />
}</p>
<p>class Student extends Person<br />
{               int age =20;<br />
	 String name=&#8221;你好&#8221;;<br />
	 public void print()</p>
<p>	 {     System.out.println(this.name);<br />
	       System.out.println(super.name);<br />
	       System.out.println(this.age);<br />
		   System.out.println(this.getInfo());<br />
	 }<br />
}</p>
<p>public class Demo03</p>
<p>{ public static void main(String[] args)<br />
     {<br />
           Student s = new Student();<br />
           s.print();<br />
     }<br />
}<br />
结果<br />
你好<br />
null<br />
20<br />
30</p>
]]></content:encoded>
	</item>
</channel>
</rss>
