class b:a 是什么意思啊?

badguycyhchen 2008-11-22 09:23:28
class A
{
protected int x = 123;
}

class B : A
{
void F()
{
A a = new A();
B b = new B();
a.x = 10; // Error
b.x = 10; // OK
}
}

这里的class B : A 是什么意思啊? - - 不要笑我哦
...全文
701 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
gengwanshanreally 2008-11-22
  • 打赏
  • 举报
回复
B:A 就是B类继承A类,A为基类,B为派生类
badguycyhchen 2008-11-22
  • 打赏
  • 举报
回复
谢谢大家
badguycyhchen 2008-11-22
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 pinyu 的回复:]
你这个例子对你来说可能难了点

class A
{
prtected int x=5;
}

class B:A
{
protected int y=6;
}

class c
{

static void main(string args[])
{
B test=new B();
console.write(test.x);
console.write(test.y);
}
}
[/Quote]

我能看懂这个
VsonChow 2008-11-22
  • 打赏
  • 举报
回复
B繼承了A,也就是說,B除了有自己的特性,同時也具有A的特性。
pinyu 2008-11-22
  • 打赏
  • 举报
回复
你这个例子对你来说可能难了点

class A
{
prtected int x=5;
}

class B:A
{
protected int y=6;
}

class c
{

static void main(string args[])
{
B test=new B();
console.write(test.x);
console.write(test.y);
}
}
长沙三毛 2008-11-22
  • 打赏
  • 举报
回复
呵呵,找本面向对象的书(C++/C#)都可以,看看哦
5Br 2008-11-22
  • 打赏
  • 举报
回复
好比 老子有的东西 会继承给儿子
儿子会拥有老子所有的东西
badguycyhchen 2008-11-22
  • 打赏
  • 举报
回复
能详细说说吗?
pinyu 2008-11-22
  • 打赏
  • 举报
回复
继承或者实现
xupeihuagudulei 2008-11-22
  • 打赏
  • 举报
回复
说明类B是继承于类A的
java反编译工具jad 1.5.8g支持 jdk1.5,jdk1.6。说明很多记住一个万能的命令基本就够用了。jad -sjava -r -8 -o **\*.class ---------------This is README file for Jad - the fast Java Decompiler.Jad home page: http://www.kpdus.com/jad.htmlCopyright 2001 Pavel Kouznetsov (jad@kpdus.com).0. Please read the disclaimer on the Jad home page.1. Installation.Unzip jad.zip file into any appropriate directory on your hard drive.This will create two files: - an executable file named 'jad.exe' (Windows *) or 'jad' (*n*x) - this README fileNo other setup is required.2. How to use JadTo decompile a single JAVA class file 'example1.class' type the following: jad example1.classThis command creates file 'example1.jad' in the current directory.If such file already exists Jad asks whether you want to overwrite it or not.Option -o permits overwriting without a confirmation.You can omit .class extension and/or use wildcards in the names ofinput files.Option -s allows to change output file extension: jad -sjava example1.classThis command creates file 'example1.java'. Be careful when usingoptions -o and -sjava together, because Jad can accidentally overwriteyour own source files.Jad uses JAVA class name as an output file name. For example, if classfile 'example1.class' contains JAVA class 'test1' then Jad will createfile 'test1.jad' rather than 'example1.jad'. If you want to specifyyour own output file name use the output redirection: jad -p example1.class > myexm1.javaOption -d allows you to specify another directory for output files,which are created, by default, in the current directory. For example: jad -o -dtest -sjava *.class (or jad -o -d test -s java *.class, which has the same effect)This command decompiles all .class files in the current directory <

62,253

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧