member function von base class wird nicht gefunden
-
hallo leute
scheinbar steht ich mal wieder voll auf der leitung das es schon weh tut.
VC2015 haut mir immer fogende Fehler raus:
(1)error C2660: "txl::gui::window_rect::width": Funktion akzeptiert keine 0 Argumente (2)error C2660: "SetWindowPos": Funktion akzeptiert keine 6 Argumente
hier der relevante code: (beide fehler sind hier in zeile 98)
//header class virtual_rect { public: virtual_rect(void) noexcept; virtual_rect(const virtual_rect&) = delete; virtual_rect(virtual_rect&&) = delete; virtual ~virtual_rect(void) noexcept; auto operator=(const virtual_rect&) -> virtual_rect& = delete; auto operator=(virtual_rect&&) -> virtual_rect& = delete; auto rect(void) const noexcept -> const txl::gui::rect&; auto left(void) const noexcept -> rect::value_type; auto top(void) const noexcept -> rect::value_type; auto right(void) const noexcept -> rect::value_type; auto bottom(void) const noexcept -> rect::value_type; virtual auto left(rect::value_type v) noexcept -> void; virtual auto top(rect::value_type v) noexcept -> void; virtual auto right(rect::value_type v) noexcept -> void; virtual auto bottom(rect::value_type v) noexcept -> void; auto width(void) const noexcept -> rect::value_type; auto height(void) const noexcept -> rect::value_type; virtual auto width(rect::value_type w) noexcept -> void; virtual auto height(rect::value_type h) noexcept -> void; virtual auto resize(rect::value_type w, rect::value_type h) noexcept -> void; virtual auto resize(const rect::size &s) noexcept -> void; virtual auto move(rect::value_type x, rect::value_type y) noexcept -> void; virtual auto move(const distance &d) noexcept -> void; virtual auto position(rect::value_type x, rect::value_type y) noexcept -> void; virtual auto position(const point &p) noexcept -> void; auto position(void) noexcept -> point; auto size(void) const noexcept -> rect::size; auto origin(void) noexcept -> point; auto vertex(rect::vertices::value_type v) const noexcept -> point; virtual auto update(void) noexcept -> bool; protected: txl::gui::rect m_rect; rect::vertices::value_type m_origin; }; /* class virtual_rect */ class window_rect : public virtual_rect { public: window_rect(base_window &w) noexcept; window_rect(const window_rect&) = delete; window_rect(window_rect&&) = delete; virtual ~window_rect(void) noexcept; auto operator=(window_rect&) -> window_rect& = delete; auto operator=(window_rect&&) -> window_rect& = delete; virtual auto left(rect::value_type v) noexcept -> void; virtual auto top(rect::value_type v) noexcept -> void; virtual auto right(rect::value_type v) noexcept -> void; virtual auto bottom(rect::value_type v) noexcept -> void; virtual auto width(rect::value_type w) noexcept -> void; virtual auto height(rect::value_type h) noexcept -> void; virtual auto resize(rect::value_type w, rect::value_type h) noexcept -> void; virtual auto resize(const rect::size &s) noexcept -> void; virtual auto move(rect::value_type x, rect::value_type y) noexcept -> void; virtual auto move(const distance &d) noexcept -> void; virtual auto position(rect::value_type x, rect::value_type y) noexcept -> void; virtual auto position(const point &p) noexcept -> void; virtual auto update(void) noexcept -> bool; private: base_window &m_base_window; auto change_rect_member(rect::value_type *member, rect::value_type value) noexcept -> void; }; /* class window_rect */ // CPP datei auto window_rect::update(void) noexcept -> bool { if(!(m_base_window.m_flags & (window_flags::position_changed | window_flags::size_changed))) return true; int f = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOREPOSITION | SWP_NOZORDER; if(!(m_base_window.m_flags & window_flags::position_changed)) f |= SWP_NOMOVE; if(!(m_base_window.m_flags & window_flags::size_changed)) f |= SWP_NOSIZE; BOOL res = SetWindowPos(m_base_window.handle(), 0, m_rect.left, m_rect.top, this->width(), virtual_rect::height(), f); return res != 0; }
bei dem aufruf von height() kommt auch der fehler wie bei width. wenn ich aber die basisklasse mit angebe, dann ist alles ok.
wo liegt da der fehler ?
-
width
(bzw.height
) wird inwindow_rect
als ein für diesen lookup gültiges Resultat deklariert, daher hört lookup dort auch auf (siehe [class.member.lookup]/4. Basisklasse angeben.
-
Arcoth schrieb:
width
(bzw.height
) wird inwindow_rect
als ein für diesen lookup gültiges Resultat deklariert, daher hört lookup dort auch auf (siehe [class.member.lookup]/4. Basisklasse angeben.und wenn ich mal eine memberfunction einer femdklasse verwenden will, muss cih zuerst nachschauen, in welcher klasse die member funktion deklariert worden ist, damit ich sie aufrufen kann ??
entweder hab ich all die jahre noch nie member funktionen von basisklassen aufgerufen oder das ist neu
-
Meep Meep schrieb:
entweder hab ich all die jahre noch nie member funktionen von basisklassen aufgerufen oder das ist neu
Nein, das ist nicht neu. Der Name wird eben verdeckt, den Effekt hast du sicherlich schon beobachtet?
struct B {int i(); }; struct A : B {int i(int);}; int main() {A().i();}
(
virtual
spielt dabei selbstverständlich keine Rolle)
-
using virtual_rect::width;
-
LordJaxom schrieb:
using virtual_rect::width;
genau