当前位置:网站首页>C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep268
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep268
2022-07-03 12:52:00 【superfreak】
using System;
namespace Chapter15InterfaceSampleP268
{
interface IInfo
{
string GetName();
string GetAge();
}
class CA :IInfo
{
public string Name;
public int Age;
public string GetName() { return Name; }
public string GetAge() { return Age.ToString(); }
}
class CB : IInfo
{
public string First;
public string Last;
public double PersonAge;
public string GetName() { return First+""+Last; }
public string GetAge() { return PersonAge.ToString(); }
}
class Program
{
static void PrintInfo(IInfo item)
{
Console.WriteLine("Name:{0},Age:{1}",item.GetName(),item.GetAge());
}
static void Main(string[] args)
{
CA a = new CA() { Name = "JohnDoe", Age = 35 };
CB b = new CB() { First = "Jane",Last= "Doe",PersonAge = 33 };
PrintInfo(a);
PrintInfo(b);
Console.WriteLine("Hello World!");
}
}
}
边栏推荐
- Application of ncnn neural network computing framework in orange school orangepi 3 lts development board
- Social community forum app ultra-high appearance UI interface
- Oh my Zsh + TMUX installation
- Two solutions of leetcode101 symmetric binary tree (recursion and iteration)
- 记录自己vulnhub闯关记录
- Kung Fu pays off, and learning is done
- Huffman coding experiment report
- elastic_ L02_ install
- 十條職場規則
- Low code platform international multilingual (I18N) technical solution
猜你喜欢
并网-低电压穿越与孤岛并存分析
Sword finger offer10- I. Fibonacci sequence
Xctf mobile--rememberother problem solving
01 three solutions to knapsack problem (greedy dynamic programming branch gauge)
阿里大于发送短信(用户微服务--消息微服务)
Social community forum app ultra-high appearance UI interface
Analysis of the influence of voltage loop on PFC system performance
Xctf mobile--app1 problem solving
Eureka self protection
记录自己vulnhub闯关记录
随机推荐
TOGAF认证自学宝典V2.0
Powerful avatar making artifact wechat applet
It feels great to know you learned something, isn‘t it?
Sword finger offer04 Search in two-dimensional array [medium]
最新版盲盒商城thinkphp+uniapp
Tianyi ty1208-z brush machine detailed tutorial (free to remove)
Sword finger offer07 Rebuild binary tree
剑指Offer05. 替换空格
[review questions of database principles]
Exploration of sqoop1.4.4 native incremental import feature
Social community forum app ultra-high appearance UI interface
01 three solutions to knapsack problem (greedy dynamic programming branch gauge)
alright alright alright
Sqoop1.4.4原生增量导入特性探秘
Deeply understand the mvcc mechanism of MySQL
Node.js: express + MySQL的使用
Ten workplace rules
Simple use and precautions of kotlin's array array and set list
【習題七】【數據庫原理】
【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)