Last active
September 3, 2020 15:39
-
-
Save VanyaBelyaev/1f06b43994b23d52fef42d03db1e15a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import ROOT | |
ROOT.gROOT.ProcessLine(""" | |
#include <string> | |
class A | |
{ | |
public: | |
A ( int a ) | |
: m_a ( a ) | |
{} ; | |
virtual ~A(){}; | |
virtual int num () const { return m_a ; } | |
std::string line () const | |
{ return std::to_string ( this->num() ) ; } | |
private: | |
int m_a {0}; | |
}; | |
""") | |
class B (ROOT.A) : | |
def __init__ ( self , b ) : | |
ROOT.A.__init__ ( self , b ) | |
def a (self ) : return 10 | |
a = ROOT.A ( 5 ) | |
print ('A-line', a.line() ) | |
b = B ( 6 ) | |
print ('B-line', b.line() ) | |
""" | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
/afs/cern.ch/user/i/ibelyaev/cmtuser/RELEASE/ostap/build/tst40.py in <module>() | |
35 print ('A-line', a.line() ) | |
36 | |
---> 37 b = B ( 6 ) | |
38 | |
39 print ('B-line', b.line() ) | |
/afs/cern.ch/user/i/ibelyaev/cmtuser/RELEASE/ostap/build/tst40.py in __init__(self, b) | |
26 | |
27 def __init__ ( self , b ) : | |
---> 28 ROOT.A.__init__ ( self , b ) | |
29 | |
30 def a (self ) : return 10 | |
TypeError: none of the 2 overloaded methods succeeded. Full details: | |
no constructor available for 'A' | |
A::A(A&) => | |
TypeError: could not convert argument 1 | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment