.NET Framework-打印对象 [英] .NET framework - Print objects

查看:104
本文介绍了.NET Framework-打印对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我回答这个问题

Please help me answer this question

Employee emp=new employee();
Car cr=new car();
emp.print ;
cr.print ;



陈述两种使用可打印对象的最佳设计方法,并解释哪种方法最好?



State two best design approach to use printable objects and explain which one is the best ?

推荐答案

您需要创建一个用于打印的接口.
确保所有类都实现了该接口.

包括用于使用接口实现打印不同类型对象的代码.
那就是我的方法.
You need to create an interface for printing.
Make sure all your classes implement that interface.

Include code for printing different types of objects using interface implementation.
That would be my approach.


这篇关于.NET Framework-打印对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆