Pascal/C++ TYS
Author |
Message |
wtd
|
Posted: Tue Dec 12, 2006 2:07 am Post subject: Pascal/C++ TYS |
|
|
Translate the following code into Pascal, in a source file called foo.pas such that it compiles with:
code: | #include <iostream>
class Foo
{
public:
virtual int foo() const = 0;
};
class Bar : public virtual Foo
{
public:
virtual int bar() const = 0;
virtual int baz() const;
};
class Baz : public virtual Bar
{
public:
Baz(int w = 1, int n = 2);
virtual ~Baz();
virtual int foo() const;
virtual int bar() const;
private:
int wooble, ninja;
};
int main()
{
Bar *qux = new Baz(1, 3);
std::cout << qux->baz() << std::endl;
}
int Bar::baz() const
{
return foo() + bar();
}
Baz::Baz(int w, int n) : wooble(w), ninja(n)
{
}
Baz::~Baz()
{
}
int Baz::foo() const
{
return wooble;
}
int Baz::bar() const
{
return ninja;
}
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
bugzpodder
|
Posted: Thu Dec 14, 2006 8:38 pm Post subject: (No subject) |
|
|
what is TYS |
|
|
|
|
|
[Gandalf]
|
Posted: Thu Dec 14, 2006 8:48 pm Post subject: (No subject) |
|
|
Test Your Skills.
Sadly, I have no clue how to do this one. Partially because I don't know any non-Turing Pascal. |
|
|
|
|
|
md
|
Posted: Thu Dec 14, 2006 9:59 pm Post subject: (No subject) |
|
|
I've been meaning to do this, but I find my free time is lacking (in between parties and all... damn those open bar parties...)
this http://attachr.com/5371 may help anyone interested, thanks to the wonderful wtd |
|
|
|
|
|
|
|