Also fix ambiguous method declaration by dropping a default parameter.
---
Hi Jon,

I'm not sure removing virtual from all Create methods really fits the
bill in all cases, are you?

I had a go at fixing this while keeping the virtuality of the methods
intact.  While at it it also occured to me that there's a tricky problem
for the compiler to differentiate the method

  Create ();

from the method

  Create (Window * = NULL, DWORD = 42);

I fixed this ambiguity by making the Window parameter a non-default
parameter.

What do you think?


Corinna

 desktop.h    | 2 +-
 main.cc      | 2 +-
 proppage.h   | 1 +
 propsheet.cc | 2 +-
 propsheet.h  | 2 +-
 window.h     | 7 ++++++-
 6 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/desktop.h b/desktop.h
index d4ce72def757..87b5ccee5302 100644
--- a/desktop.h
+++ b/desktop.h
@@ -33,7 +33,7 @@ public:
   {
   };

-  bool Create ();
+  virtual bool Create ();

   virtual void OnInit ();
   virtual void OnActivate ();
diff --git a/main.cc b/main.cc
index b570c6cb18ec..9035260972b3 100644
--- a/main.cc
+++ b/main.cc
@@ -213,7 +213,7 @@ main_display ()
   MainWindow.AddPage (&Desktop);

   // Create the PropSheet main window
-  MainWindow.Create ();
+  MainWindow.Create (NULL);

   // Uninitalize COM
   if (sl)
diff --git a/proppage.h b/proppage.h
index 64f822b515be..5301a97a8221 100644
--- a/proppage.h
+++ b/proppage.h
@@ -115,6 +115,7 @@ public:
     IsLast = false;
   };

+  virtual bool Create () { return false; };
   virtual bool Create (int TemplateID);
   virtual bool Create (DLGPROC dlgproc, int TemplateID);
   virtual bool Create (DLGPROC dlgproc,
diff --git a/propsheet.cc b/propsheet.cc
index faf6583f0803..3563a388cd48 100644
--- a/propsheet.cc
+++ b/propsheet.cc
@@ -341,7 +341,7 @@ PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 }

 bool
-PropSheet::Create (const Window * Parent, DWORD Style)
+PropSheet::Create (Window * Parent, DWORD Style)
 {
   PROPSHEETHEADERW p;

diff --git a/propsheet.h b/propsheet.h
index b900e790c32f..870905cf9777 100644
--- a/propsheet.h
+++ b/propsheet.h
@@ -47,7 +47,7 @@ public:
   void SetHWNDFromPage (HWND h);
   void AdjustPageSize (HWND page);

-  virtual bool Create (const Window * Parent = NULL,
+  virtual bool Create (Window *Parent,
                       DWORD Style =
                       WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);

diff --git a/window.h b/window.h
index 1dfb2a9f7514..bd3080e758fc 100644
--- a/window.h
+++ b/window.h
@@ -82,7 +82,12 @@ public:
   Window ();
   virtual ~ Window ();

-  virtual bool Create (Window * Parent = NULL,
+  virtual bool Create () { return false; };
+  virtual bool Create (int) { return false; };
+  virtual bool Create (DLGPROC, int) { return false; };
+  virtual bool Create (DLGPROC, BOOL (*) (HWND, int, HWND, UINT), int)
+  { return false; };
+  virtual bool Create (Window *Parent,
                       DWORD Style =
                       WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);

--
2.43.0

Reply via email to