C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 1st, 2003, 04:20 AM
Meindert Meindert is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 Meindert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question C++ Inheritance Constructor Problem

Here is my super class:
Code:
#ifndef OPENGLSCENE_H
#define OPENGLSCENE_H

#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>

#include "Globals.h"
#include "Triangle.h"

#define TRUE 1
#define FALSE 0

class OpenGLScene {	
	HGLRC hRC;
	HWND hWnd;
	HINSTANCE hInstance;
	HDC hDC;
	BOOL done;
	bool fullscreen;
	MSG msg;
	GLvoid ReSizeGLScene(GLsizei width, GLsizei height);
	int InitGL(GLvoid);
	BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag);
	
public:
	OpenGLScene (char* title, int width, int height, int bits, bool fullscreenflag);
	GLvoid KillGLWindow(GLvoid);
	virtual void addTriangle (Triangle *T) = 0;
	virtual int DrawGLScene(GLvoid) = 0;
	virtual void DrawTriangle (Triangle *T) = 0;
	int start ();
};

#endif


And below is my derived class:
Code:
#include "OpenGlScene.h"


class MyOpenGLScene : public OpenGLScene 
{
	Triangle *T;

public:
	MyOpenGLScene(char* title, int width, int height, int bits, bool fullscreenflag);
	void addTriangle(Triangle *T);
	void DrawTriangle(Triangle *T);
	int DrawGLScene();
};

MyOpenGLScene::MyOpenGLScene(char* title, int width, int height, int bits, bool fullscreenflag) {
	title = "Stage 1";
	width = 800;
	height = 600;
	bits = 16;
	fullscreenflag = 0;
}

void addTriangle(Triangle *T) {

}

void DrawTriangle(Triangle *T) {

}

int DrawGLScene() {

	return 0;
}


Now the error : error C2512: 'OpenGLScene' : no appropriate default constructor available
Error executing cl.exe.

I don't know what's wrong...is it my sub class constructor wrong? Please help me!

Reply With Quote
  #2  
Old November 1st, 2003, 05:30 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 785 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 16
You declared the OpenGLScene method/constructor, however, you never defined it.

You can define it and leave it empty if it isn't going to do anything, but you need to have it.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old November 1st, 2003, 11:58 PM
Meindert Meindert is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 Meindert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks laidbak...

Thanks laidbak
I had solved my problem..... ^_^v

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > C++ Inheritance Constructor Problem


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap