Question:
question involving c++ programming?
Run with me
2011-04-27 23:08:11 UTC
This will likely be very unclear, and I apologize for that.

I'm working on a program that draws a checker board on the screen through fltk using some files specialized for my programming class. the files were taken from a book written by Bjarne Stroustrup.

Basically, I have a class for the window. In the main function, I can create the window, create shapes to put in the window, and put the shapes in the window.

One of the restrictions of my project is that we have a small number of commands in each function. When I try to create shapes outside the main function, it gives me an error saying that the shape class is private, even when I put this code directly in the window class.

How can I fix this so I can create shapes outside the main function?

Thanks!

How can I fix this error.
Three answers:
Swapnil D
2011-04-27 23:32:02 UTC
make your function of shape class as public.



class shape

{

public : ...

}
alakit013
2011-04-28 06:18:08 UTC
The simplest way is:

class shape

{

public:

...

};

It is not so good, so declare as public only function(s) of your class you need to call from your main().

Good luck!
anonymous
2011-04-28 06:20:16 UTC
ya, alakit is right


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...