Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826

    [c++]default constructor

    ciao.
    Ho provato a compilare questo codice :
    bool CPresenter::InitCV()
    {
    m_pModel = new CModel();
    return true;
    }
    ma mi becco questo errore del compilatore vs 2008
    :
    Error 1 error C2512: 'CModel' : no appropriate default constructor available c:\programmazione\wild magic 4\geometrictools\wildmagic4\samplegraphics\dynamic textures\presenter.cpp 17

    e non riesco a capire perchè.
    In qualsiasi funzione lo metto nella classe cpresenteer mi da quest errore.

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    pardon il codice è questo:
    [code]
    CPresenter::CPresenter()
    {

    }

    CPresenter::CPresenter( DynamicTextures* pView )
    {
    m_view = pView;
    m_pModel = new CModel();///////////////////errore
    }

    CPresenter::~CPresenter(void)
    {
    }

    bool CPresenter::InitCV()
    {

    return true;
    }
    [code]

  3. #3
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    codice:
    m_pModel = new CModel;
    Do per scontato che CModel abbia un costruttore di default (attento che se esiste anche un solo costruttore da te definito, il costruttore di default lo devi scrivere esplicitamente).
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.