class Cars
{
public Engine CreateEngine()
{
Engine engine = new Engine();
return engine;
}
}
class Cars
{
Engine engine = new Engine();
public Engine CreateEngine()
{
return engine;
}
}
class Cars
{
private Engine _engine;
public Engine Engine => _engine; //если нужен доступ к Engine из другого класса
public void CreateEngine()
{
_engine = new Engine();
}
}