CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Oct 2016
    Posts
    22

    [RESOLVED] Class inheritance problem.

    Hello, I was searching on the internet for my answer but I found nothing. All I want to make is Object that can move sf::Recrtangle or sf::Sprite. For example:

    For example:
    Code:
    	class Movable {
    	private:
    		std::string name;
    
    	protected:
    		Movable(std::string);
    
    	public:
    		void moveRight(int lenght); //to move rectangleshape from Rectangle class.
    
    	};
    
    	class Rectangle : Movable {
    	private:
    		sf::RectangleShape rectangleshape;
    
    	public:
    		Rectangle(std::string rectangle_name) : Object(rectangle_name) {}
    
    	};
    
    	int main() {
    		Rectangle rectangle("name");
    
    		rectangle.moveRight(64);
    
    	}
    What should i add or change in my code to just move rectangle shape from movable class.
    Last edited by 2kaud; October 9th, 2016 at 10:37 AM. Reason: Added code tags

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