lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ question


From: Benkő Pál
Subject: Re: C++ question
Date: Wed, 27 Jun 2012 22:46:04 +0200

hi Mike,

> class MyClass {
> typedef int (*happy)(int a, int b, int c);
>
> happy foo
> happy bar;
> happy baz;
> }
>
> Is there a way to define foo, bar, and baz with the same typedef in the c++ 
> file or do I have to enumerate all the arguments for the function definition 
> à la
>
> int baz (int a, int b, int c) { return a + b + c; }

no.  foo, bar and baz are _defined_ in the header as pointers to
function (and not declared as functions of given signature).
you can use them like

int lily (int i, int n, int t)
{
  return i + n * t;
}

struct pond
{
  static int lily (int i, int n, int t) { return i *n + t; }
};

foo = &lily;
bar = &pond::lily;
baz = foo;

p



reply via email to

[Prev in Thread] Current Thread [Next in Thread]