CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009
    Posts
    88

    [RESOLVED] regarding new and delete error

    can u please help me debugging this
    Code:
    CCapacitor *c=new CCapacitor(x1,y1,capbus,capsize,capval,capname,caporien);
    errors displayed is:
    error C2248: 'new' : cannot access public member declared in class 'CObject'
    f:\microsoft visual studio\vc98\mfc\include\afx.h(683) : see declaration of 'new'
    error C2248: 'delete' : cannot access public member declared in class 'CObject'
    f:\microsoft visual studio\vc98\mfc\include\afx.h(685) : see declaration of 'delete'

    my declaration of CCapacitor class is:
    Code:
    class CCapacitor:CObject
    {
    protected:
    	DECLARE_SERIAL(CCapacitor)
    
    public:
    	long m_x1;
    	long m_y1;
    	long m_capbus;
    	long m_capsize;
    	double m_capval;
    	CString m_capname;
    	long m_caporien;
    public:
    	CCapacitor()
    	{
    	}
    	CCapacitor(long x1,long y1,long capbus,long capsize,double capval,CString capname,long caporien)
    	{
    		m_x1=x1;
    		m_y1=y1;
    		m_capbus=capbus;
    		m_capsize=capsize;
    		m_capval=capval;
    		m_capname=capname;
    		m_caporien=caporien;
    	}
    	void Draw_Capacitor(CDC *pDC);
    		
    // Overrides
    	// ClassWizard generated virtual function overrides
    	//{{AFX_VIRTUAL(CCapacitor)
    	public:
    	virtual void Serialize(CArchive& ar);   // overridden for document i/o
    	//}}AFX_VIRTUAL
    
    };

  2. #2
    Join Date
    May 2009
    Posts
    88

    Re: regarding new and delete error

    i gotit solved no need to repl ne mor..............

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: regarding new and delete error

    "class CCapacitor: public CObject"

  4. #4
    Join Date
    May 2009
    Posts
    88

    Re: regarding new and delete error

    yeah you got that write.......

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured