Home > Back-end >  Object-oriented analysis and design
Object-oriented analysis and design

Time:10-03

用c++实现设计两个类A B,要求根据创建者模式(creater) 将创建A实例的职责分配给B 并在main函数中实例化类B,要求并将A的实例化展示出来(任何形式)大佬们能否帮忙写下代码写不出来了

CodePudding user response:

 
Class A
{
Protected:
(A) {printf (" created A "); };
Public:
Friend class CB.
};
The class CB
{
Public:
The static
A * CreateA ()
{
The return of new A;
}
};


  • Related