Skip to content

Polymorphism Issues: Classes not being saved from browser to .sketch file #142

@mikewesthad

Description

@mikewesthad

Here's one way to replicate the polymorphism issue that we were talking about @bakercp.

Create a new project, paste the below classes in and hit run. It gives an error that indicates DerivedClass isn't extending BaseClass (error: cannot convert 'DerivedClass_' to 'BaseClass_' in initialization).

If I open up BaseClass.sketch in sublime, it looks correct. If I open up DerivedClass.sketch in sublime, it hasn't been updated from the default template (so it isn't a subclass of BaseClass).

Haven't gotten a chance to do any additional detective work on this. This is happening on win 8.1 (latest ofSketch), does it happen on OSX?

Main Class:

#include "BaseClass.h"
#include "DerivedClass.h"
void setup() {  
    std::shared_ptr<BaseClass> a = std::shared_ptr<BaseClass>(new BaseClass());
    std::shared_ptr<BaseClass> b = std::shared_ptr<BaseClass>(new DerivedClass());
}

Base Class:

#pragma once
class BaseClass{
public:
    BaseClass(){
    }   
};

Derived Class:

#include "BaseClass.h"
class DerivedClass: public BaseClass{
public:
    DerivedClass(){
    }   
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions