没有合适的资源?快使用搜索试试~ 我知道了~
C#入门之面向对象程序设计篇[归纳].pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 51 浏览量
2021-10-11
00:55:24
上传
评论
收藏 653KB PDF 举报
温馨提示
试读
21页
C#入门之面向对象程序设计篇[归纳].pdf
资源推荐
资源详情
资源评论
: http://blog.pfan.cn/xman
http://blog.csdn.net/phunxm
C#
1
--
--
--
--
-- {get(),set()}
--
-- (operator)
-- (static)
2
--
--
-- (private,protected,public,internal)
-- (sealed)
-- (abstract)
-- (interface)
-- (delegate)
-- (event)
1
2
C++
1 top
1
//Class of Person
public class Person
{
private string name;
private char sex;
private int age;
public Person(string n, char s, int a) //
{
name=n;
sex=s;
age=a;
}
public void Display()
{
Console.WriteLine( name:{0} ,name);
Console.WriteLine( sex:{0} ,sex);
Console.WriteLine( age:{0} ,age);
}
}
= new ( ); // :
( ); // C++
//
public class ClassMain{
public static void Main(){
Person P = new Person(" ", ' ', 28);
//Person P = new Person(" " , , 28); //
//Person P = new Person(" " , "" , 28); // string char
//string " char '
//Person P (" ", ' ', 28); //C++
// ; =( )
P.Display();
Console.ReadKey();
}
}
top
C#
1
2
3
int 0
4
public Employee(string n, char s, int a, string d, decimal sa) : base(n, s, a) { }
5 this
public Person():this (" ", ' ', 28);{}
private
Person public Person(string n,char s,int a){}
top
delete
~
void
top
const
top
C++ [ ] ;
string model= "Nisan";
newpublic protectedinternal privatestaticreadonly
private
Person
private string name;
private char sex;
private int age;
top
C#
[ ] [ ] { }
[ ] internal
Person public void Display(){}
C#
using System;
namespace Test
{
class Class1
{
static void Swap(int a,int b) //a,b
{
int t;
t=a;a=b;b=t;
}
static void Swap1(ref int a,ref int b) //a,b
{
int t;
t=a;a=b;b=t;
}
static void OutMultiValue( int a,out int b) //
{
b=a*a;
}
static void MutiParams( params int []a)//a
{
for(int i=0;i<a.Length;i++)
{
Console.WriteLine( "a[{0}]={1}" ,i,a[i]);
}
}
static void Main( string[] args)
{
int x=10,y=20;
int []b={10,20,30};
int v;
Swap(x,y);
Console.WriteLine( "x={0},y={1}" ,x,y);
Swap1(ref x,ref y);
Console.WriteLine( "x={0},y={1}" ,x,y);
OutMultiValue(10, out v);
Console.WriteLine( "v={0}" ,v);
MutiParams(b);
Console.ReadKey();
}
}
}
<1>. Swap(x,y) x,y
<2>. Swap1(ref x,ref y) x,y
ref
ref C/C++ &
<3>. OutMultiValue(10,out v);
out
剩余20页未读,继续阅读
资源评论
xhr131452007
- 粉丝: 7
- 资源: 14万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功