惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Security Latest
Security Latest
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AI
AI
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
S
Secure Thoughts
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
V
V2EX
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tenable Blog
T
Threat Research - Cisco Blogs
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
Lohrmann on Cybersecurity
F
Full Disclosure
H
Help Net Security
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
O
OpenAI News
S
Securelist

博客园 - tf.li

清理MVC4 Internaet 项目模板清理 SQL2014 尝试读取或写入受保护的内存。这通常指示其他内存已损坏 nodejs 环境配置技巧 mongdb window 服务安装批处理 bower 安装后 jade 引用404问题 我的Prototype模式框架 转自CnBeta 令人深思 [译稿]为什么我们不要 .NET 程序员 JSON.NET、WebService与JQuery协同工作 我修改的IP地址掩码 呵呵~~开心 Ext.Ajax.request 传值问题 从小做大之一---------一切从建模开始 [求助]关于文本行转列的疑问~~ To Terrylee 我的设计模型之装饰者模式 我对线程池的一点理解 面向接口编程之惑 第二版 面向接口编程之惑 我的设计模型之适配器模式 我的设计模型之简单工厂
我的设计模型之小议工厂模式
tf.li · 2008-07-30 · via 博客园 - tf.li

今天温习Webcast讲的工厂模式,自己也比较有感觉,写了一些东西 但是写着写着出事了!~

大家还是先看代码吧

这是接口

    interface InterCar
    
{
     
void Run();
      
void Turn();
    }

   abstract  class People
    
{
        
public int age getset; }
        
public string name getset; }
        
public Car mycar getset; }
    }

   
class trucker: People,InterCar
   
{

       
public trucker(Car mycar)
       

           
this.mycar=mycar;
       }


       
InterCar 成员
   }

这是我的类

Code

这是工厂方法

但是我在调用的时候会出现如下错误啊

   People people = PeopleFactory.CreatePeople(pname,mycar);

 抽象类People并不认识Interface InterCar,更不用说实现类中的两个方法了。

people.Run();
people.Turn();

不置可否帮助我解答一下。我有了答案也后会贴出来的。