C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Zeiger auf template basisklasse

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Carsten Spie337
Guest





PostPosted: Tue Dec 21, 2004 1:51 pm    Post subject: Zeiger auf template basisklasse Reply with quote



Hallo zusammen ,

ich habe folgendes Problem:

Eine template Klasse
template<class T> class B
{
virtual void f()=0;
};

mehrere davon abgeleitete Klassen
class C : public B<x>
{
virtual void f(){};
}
class D : public B<x>
{
virtual void f(){};
}

jetzt möchte ich einen Zeiger auf die Template-Basisklasse (B) haben:
B* p[42];
so dass
p[0] = new C;
p[1] = new D;
p[0]->f();
etc. möglich ist.

Nur wie definier ich den Zeiger?
B* oder B<>* hab ich probiert, gibt beides Compilermecker.

Oder ist nur folgender Ansatz möglich:
class A
{
virtual void f()=0;
}
template<class T> class B:public A
{
};
und
A* p[42]
funktioniert dann natürlich.

Danke für Tipps,
Gruß

Carsten

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Hendrik Belitz
Guest





PostPosted: Tue Dec 21, 2004 3:12 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote



Carsten Spieß wrote:

Quote:
Hallo zusammen ,
[...]
Nur wie definier ich den Zeiger?

Garnicht. Auf was willst Du denn den Zeiger definieren? Ohne
template-Parameter existiert doch überhaupt keine Klasse, sondern nur ein
Klassentemplate.

Quote:
B* oder B<>* hab ich probiert, gibt beides Compilermecker.

s.o.

Quote:
Oder ist nur folgender Ansatz möglich: [...]

Ja, so wird es funktionieren. Wenn Du virtuelle Funktionen vermeiden
möchtest, gibt es natürlich noch weitere Tricks (Stichwort
Barton-Nackman)...

--
To get my real email adress, remove the two onkas
--
Hendrik Belitz
- Abort, Retry, Fthagn? -

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Michael Karcher
Guest





PostPosted: Tue Dec 21, 2004 3:16 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote



Carsten Spieß <me (AT) privacy (DOT) net> wrote:
Quote:
Eine template Klasse
template<class T> class B
{
virtual void f()=0;
};
Im C++-Standard ist dafür inzwischen der Begriff Klassentemplate

gebräuchlich, da es sich eben nicht um eine Klassen handelt. B ist keine
Klasse! B ist eine Vorlage, aus der für jedes T *verschiedene* Klassen
generiert werden können.

Quote:
mehrere davon abgeleitete Klassen
class C : public B<x
{
virtual void f(){};
}
class D : public B {
virtual void f(){};
}
Ist das

verschiedene Klassen, die von einer gleichen Basisklasse abgeleitet sind.

Quote:
jetzt möchte ich einen Zeiger auf die Template-Basisklasse (B) haben:
B* p[42];
Wie ich schon sagte: B ist keine Klasse, noch nicht einmal ein Typ, also

kannst Du auch keine Zeiger auf Objekte vom Typ B definieren.

Quote:
Nur wie definier ich den Zeiger?
B* oder B<>* hab ich probiert, gibt beides Compilermecker.
Wenn das <x> jedemal gleich war, als B<x>, denn B<x> ist eine Klasse, und

wenn das eine gemeinsame Basisklasse von C und D ist, kannst Du Zeiger auf C
und D in Zeiger auf B<x> konvertieren.

Quote:
Oder ist nur folgender Ansatz möglich:
class A
{
virtual void f()=0;
}
template<class T> class B:public A
{
};
und
A* p[42]
funktioniert dann natürlich.

Klar. Im Gegensatz zu B ist A eine Klasse. Und da alle verschiedenen aus
der Vorlage B generierten Klassen B<...> von der selben Klasse A abgeleitet
sind, ist dieser Code unproblematisch. Vermutlich auch die einzige Lösung.

Michael Karcher

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Tue Dec 21, 2004 3:18 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

Carsten Spieß wrote:

Quote:
Hallo zusammen ,

ich habe folgendes Problem:

Eine template Klasse
template<class T> class B
{
virtual void f()=0;
};

mehrere davon abgeleitete Klassen
class C : public B<x
{
virtual void f(){};
}
class D : public B {
virtual void f(){};
}

jetzt möchte ich einen Zeiger auf die Template-Basisklasse (B) haben:
B* p[42];
so dass
p[0] = new C;
p[1] = new D;
p[0]->f();
etc. möglich ist.

Nur wie definier ich den Zeiger?
B* oder B<>* hab ich probiert, gibt beides Compilermecker.

B ist ja auch kein Typ. Du mußt die Template-Parameter mit angeben, damit
daraus ein Typ wird. In deinem Beispiel oben sind C und D von B<x>
abgeleitet, also müßte es z.B. so heißen:

B<x>* p[42];

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Falk Tannhäuser
Guest





PostPosted: Tue Dec 21, 2004 3:33 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

Carsten Spieß wrote:
Quote:
Eine template Klasse
template<class T> class B
{
virtual void f()=0;
};

mehrere davon abgeleitete Klassen
class C : public B<x
{
virtual void f(){};
}
class D : public B {
virtual void f(){};
}

Ist das 'x' in allen Fällen der selbe Typ?
Wenn ja, sollte es

Quote:
jetzt möchte ich einen Zeiger auf die Template-Basisklasse (B) haben:
B* p[42];

B
heißen.

Wenn nein, z.B.

class C : public B<int> { ... };
class D : public B<long> { ... };

hast' Pech! B<int> und B<long> sind 2 verschiedene Klassen ohne
Vererbungsrelation zwischen beiden, so dass es keine gemeinsame
Basisklasse für C und D gibt - es sei denn, du nimmst die von
dir angegebene Lösung

Quote:
class A
{
virtual void f()=0;
}
template<class T> class B : public A
{
};
und
A* p[42]
funktioniert dann natürlich.

MfG
Falk

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Carsten Spieß
Guest





PostPosted: Sat Dec 25, 2004 7:13 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

green beans work especially well. Meat is not necessary every day, don?t
be afraid to alter any dish to vegetarian tastes.

1 premature baby, born dead
Large bunch of mustard greens
2 white onions, 1 cup chopped celery
Vegetable oil (or hog fat)
Salt, pepper, garlic, etc.

Lightly brown onions, celery, garlic and meat in large heavy pot.
Add a little water and the greens (which should be thoroughly cleaned and washed).
Smother slowly for at least 2 hours, adding small amounts of water
when it starts to stick.
Stir frequently.
When ready - serve with rice, grilled smoked sausage, green salad, and iced tea.
Coffee and apple pie then brandy.



Maternity Ward Pot Luck Dinner

If you can?t get anything fresh from the hospital, nursery, or morgue;
you can at least get rid of all the leftovers in your refrigerator.

1 - 2 lbs. cubed meat (human flesh, chicken, turkey, beef...)
1 -2 lbs. coarsely chopped vegetables
(carrots, potatoes, turnips, cauliflower, cabbage...)
Bell pepper
onions
garlic
ginger
salt pepper, etc.
Olive oil
butter

Brown the meat and some chopped o


Back to top
Michael Karcher
Guest





PostPosted: Sat Dec 25, 2004 7:23 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

glaze,
return to oven and bake 20 minutes more to form a glaze.
Cut ribs into individual pieces and serve with extra sauce.



Fresh Sausage

If it becomes necessary to hide the fact that you are eating
human babies, this is the perfect solution.
But if you are still paranoid, you can substitute pork butt.

5 lb. lean chuck roast
3 lb. prime baby butt
2 tablespoons each:
salt
black, white and cayenne peppers
celery salt
garlic powder
parsley flakes
brown sugar
1 teaspoon sage
2 onions
6 cloves garlic
bunch green onions, chopped

Cut the children?s butts and the beef roast into pieces
that will fit in the grinder.
Run the meat through using a 3/16 grinding plate.
Add garlic, onions and seasoning then mix well.
Add just enough water for a smooth consistency, then mix again.
Form the sausage mixture into patties or stuff into natural casings.



Stillborn Stew

By definition, this meat cannot be had altogether fresh,
but have the lifeless unfortunate available immediately after delivery,
or use high quality beef or pork roasts (it is cheaper and better to
cut up a whole roast than to buy stew meat).

1 stillbirth, de-boned and cubed
¼ cup vegetable oil
2 large onions
bell pepper
celery
garlic
½ cup red wine
3 Irish potatoes
2 large carrots

This is a simple classic stew that makes natural gravy,
thus it does not have to be thickened.
Brown the meat quickly in very hot oil, remove and set aside.
Brown the onions, celery, pepper and garlic.
De-glaze with wine, return meat to the pan and season well.
Stew on low fire adding small amounts of water and
season


Back to top
Falk Tannhäuser
Guest





PostPosted: Sat Dec 25, 2004 7:26 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

De-glaze with sherry, cooking off the alcohol.
Add broth (optional) cook a few more minutes.
Add the cornstarch, cook a few minutes till thick,
then place the stuffing into a colander and cool;
2 hours
Wrap the rolls:
Place 3 tablespoons of stuffing in the wrap, roll tightly -
corner nearest you first, fold 2 side corners in,
wrap till remaining corner is left.
Brush with egg, seal, and allow to sit on the seal for
a few minutes.
Fry the rolls:
325° if using egg roll wraps, 350° for spring roll wraps.
Deep fry in peanut oil till crispy golden brown, drain on paper towels.



Lemon Neonate

Turkey serves just as well, and in fact even looks a bit like a
well-dressed baby. By the time you turn the child?s breast into
cutlets, it will be indistinguishable. The taste of young human,
although similar to turkey (and chicken) often can be wildly
different depending upon what he or she has consumed during its
10 to 14 months of life...

4 well chosen cutlets (from the breasts of 2 healthy neonates)
2 large lemons (fresh lemons always, if possible)
Olive oil
Green onions
Salt
pepper
cornstarch
neonate stock (chicken, or turkey stock is fine)
garlic
parsley
fresh cracked black pepper

Season and sauté the cutlets in olive oil till golden brown, remove.
Add the garlic and onions and cook down a bit.
Add some lemon juice and some zest, then de-glaze with stock.
Add a little cornstarch (dissolved in cold water) to the sauce.
You ar


Back to top
Hendrik Belitz
Guest





PostPosted: Sat Dec 25, 2004 7:49 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

De-glaze with sherry, cooking off the alcohol.
Add broth (optional) cook a few more minutes.
Add the cornstarch, cook a few minutes till thick,
then place the stuffing into a colander and cool;
2 hours
Wrap the rolls:
Place 3 tablespoons of stuffing in the wrap, roll tightly -
corner nearest you first, fold 2 side corners in,
wrap till remaining corner is left.
Brush with egg, seal, and allow to sit on the seal for
a few minutes.
Fry the rolls:
325° if using egg roll wraps, 350° for spring roll wraps.
Deep fry in peanut oil till crispy golden brown, drain on paper towels.



Lemon Neonate

Turkey serves just as well, and in fact even looks a bit like a
well-dressed baby. By the time you turn the child?s breast into
cutlets, it will be indistinguishable. The taste of young human,
although similar to turkey (and chicken) often can be wildly
different depending upon what he or she has consumed during its
10 to 14 months of life...

4 well chosen cutlets (from the breasts of 2 healthy neonates)
2 large lemons (fresh lemons always, if possible)
Olive oil
Green onions
Salt
pepper
cornstarch
neonate stock (chicken, or turkey stock is fine)
garlic
parsley
fresh cracked black pepper

Season and sauté the cutlets in olive oil till golden brown, remove.
Add the garlic and onions and cook down a bit.
Add some lemon juice and some zest, then de-glaze with stock


Back to top
Carsten Spieß
Guest





PostPosted: Sat Dec 25, 2004 8:01 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

Add a little water and the greens (which should be thoroughly cleaned and washed).
Smother slowly for at least 2 hours, adding small amounts of water
when it starts to stick.
Stir frequently.
When ready - serve with rice, grilled smoked sausage, green salad, and iced tea.
Coffee and apple pie then brandy.



Maternity Ward Pot Luck Dinner

If you can?t get anything fresh from the hospital, nursery, or morgue;
you can at least get rid of all the leftovers in your refrigerator.

1 - 2 lbs. cubed meat (human flesh, chicken, turkey, beef...)
1 -2 lbs. coarsely chopped vegetables
(carrots, potatoes, turnips, cauliflower, cabbage...)
Bell pepper
onions
garlic
ginger
salt pepper, etc.
Olive oil
butter

Brown the meat and some chopped onions, peppers, and garilic in olive oil,
place in baking dish, layer with vegetables seasoning and butter.
Bake at 325° for 30 - 45 minutes.
Serve with hot dinner rolls, fruit salad and sparkling water.



Bébé Buffet 1

Show off with whole roasted children replete with apples in mouths -
and babies? heads stuffed with wild rice. Or keep it simple with a
hearty main course such as stew, lasagna, or meat loaf.

Some suggestions

Pre-mie pot pies, beef stew, leg of lamb, stuffed chicken, roast pork spiral ham,
Cranberry pineapple salad, sweet potatoes in butter, vegetable platter, tossed salad with tomato and avocado, parsley new potatoes, spinich cucumber salad, fruit salad
Bran muffins, dinner rolls, soft breadsticks, rice pilaf, croissants
Apple cake with rum sauce, frosted banana nut bread sherbet, home made brownies
Iced tea, water, beer, bloody marys, lemonade, coffee

The guests select food, beverages, silverware... everything from the buffet table.
They move to wherever they are comfortable, and sit with whoever they choose.
Provide trays so your guests will not spill everything all over your house from
carrying too much, nor will they have to make 10 tri


Back to top
Michael Karcher
Guest





PostPosted: Sat Dec 25, 2004 8:04 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

along with some minced onion
then fold in half, trimming neatly.
Dredge in flour, eggwash, then seasoned breadcrumbs;
allow to sit for a few minutes.
Sauté in butter and olive oil until golden brown,
about 6 minutes on each side.



Shish Kababes

As old as the hills, this technique has employed seafood, beef, pork, lamb,
poultry, and vegetables; just about anything can be grilled, and young humans
are no exception!

High quality marinade (Teriyaki and garlic perhaps)
1 inch cubes of tender meat, preferably from the nursery
Onions
bell peppers
Wooden or metal skewers

Marinate the meat overnight.
Get the grill good and hot while placing meat, vegetables, and
fruit such as pineapples or cherries on the skewers.
Don?t be afraid to use a variety of meats.
Grill to medium rare,
serve with garlic cous-cous and sautéed asparagus.
Coffee and sherbet for desert then walnuts, cheese, and port.
Cigars for the gentlemen (and ladies if they so desire)!



Crock-Pot Crack Baby

When the quivering, hopelessly addicted crack baby succumbs to death,
get him immediately butchered and into the crock-pot, so that any
remaining toxins will not be fatal. But don?t cook it too long,
because like Blowfish, there is a perfect medium between the poisonous
and the stimulating. Though it may not have the same effect on your
guests, a whole chicken cooked in this fashion is also mighty tasty.

1 newborn - cocaine addicted, freshly expired, cleaned and butchered
Carrots
onions
leeks
celery
bell pepper
potatoes
Salt
pepper
garlic, etc
4 cups water

Cut the meat into natural pieces and brown very well in olive oil,
remove, then brown half of the onions, the bell pepper, and celery.
When brown, mix everything into the crock-pot, and in 6 to 8 hours you
have turned a


Back to top
Rolf Magnus
Guest





PostPosted: Sat Dec 25, 2004 8:28 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

etc.
1 tablespoon cornstarch dissolved in a little cold water
1 egg beaten

Make the stuffing:
Marinate the flesh in a mixture of soy and teriyaki sauces
then stir fry in hot oil for till brown - about 1 minute, remove.
Stir-fry the vegetables.
Put the meat back into the wok and adjust the seasoning.
De-glaze with sherry, cooking off the alcohol.
Add broth (optional) cook a few more minutes.
Add the cornstarch, cook a few minutes till thick,
then place the stuffing into a colander and cool;
2 hours
Wrap the rolls:
Place 3 tablespoons of stuffing in the wrap, roll tightly -
corner nearest you first, fold 2 side corners in,
wrap till remaining corner is left.
Brush with egg, seal, and allow to sit on the seal for
a few minutes.
Fry the rolls:
325° if using egg roll wraps, 350° for spring roll wraps.
Deep fry in peanut oil till crispy golden brown, drain on paper towels.



Lemon Neonate

Turkey serves just as well, and in fact even looks a bit like a
well-dressed baby. B


Back to top
Rolf Magnus
Guest





PostPosted: Sat Dec 25, 2004 9:20 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

ground beef to be found there instead.

8 large cabbage leaves
1 lb. lean ground newborn human filets, or ground chuck
Onions
peppers
celery
garlic
soy sauce
salt pepper, etc
Olive oil
breadcrumbs
Tomato Gravy (see index)

Boil the cabbage leaves for 2 minutes to soften.
In skillet, brown the meat in a little olive oil,
then add onions, peppers, and celery (all chopped finely)
and season well.
Place in a large bowl and cool.
Add seasoned breadcrumbs and a little of the tomato gravy,
enough to make the mixture pliable.
Divide the stuffing among the cabbage leaves then roll.
Place seam down in a baking pan.
Ladle tomato gravy on top,
and bake at 325° for 30 - 45 minutes.



Umbilical Cordon Bleu

Nothing is so beautiful as the bond between mother and child,
so why not consume it?
Children or chicken breasts will work wonderfully also.

4 whole umbilical chords (or baby breasts, or chicken breasts)
4 thin slices of smoked ham, and Gruyere cheese
Flour
eggwash (milk and eggs)
seasoned bread crumbs
1


Back to top
Hendrik Belitz
Guest





PostPosted: Sat Dec 25, 2004 10:47 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

stir fry in hot oil for till brown - about 1 minute, remove.
Stir-fry the vegetables.
Put the meat back into the wok and adjust the seasoning.
De-glaze with sherry, cooking off the alcohol.
Add broth (optional) cook a few more minutes.
Add the cornstarch, cook a few minutes till thick,
then place the stuffing into a colander and cool;
2 hours
Wrap the rolls:
Place 3 tablespoons of stuffing in the wrap, roll tightly -
corner nearest you first, fold 2 side corners in,
wrap till remaining corner is left.
Brush with egg, seal, and allow to sit on the seal for
a few minutes.
Fry the rolls:
325° if using egg roll wraps, 350° for spring roll wraps.
Deep fry in peanut oil till crispy golden brown, drain on paper towels.



Lemon Neonate

Turkey serves just as well, and in fact even looks a bit like a
well-dressed baby. By the time you turn the child?s breast into
cutlets, it will be indistinguishable. The taste of young human,
although similar to turkey (and chicken) often can be wildly
different depending upon what he or she has consumed during its
10 to 14 months of life...

4 well chosen cutlets (from the breasts of 2 healthy neonates)
2 large lemons (fresh lemons always, if possible)
Olive oil
Green onions
Salt
pepper
cornstarch
neonate stock (chicken, or turkey stock is fine)
garlic
parsley
fresh cracked black pepper

Season and sauté the cutlets in olive oil till golden brown, remove.
Add the garlic and onions and cook down a bit.
Add some lemon juice and some zest, then de-glaze with stock.
Add a little cornstarch (dissolved in cold water) to the sauce.
You are just about there, Pour the sauce over the cutlets,
top with parsley, lemon slices and cracked pepper.
Serve with spinach salad, macaroni and cheese (homemade) and iced tea...



Spaghetti with Real Italian Meatballs

If you don?t have an expendable bambino on hand,
you can use a pound


Back to top
Falk Tannhäuser
Guest





PostPosted: Sat Dec 25, 2004 11:00 pm    Post subject: Re: Zeiger auf template basisklasse Reply with quote

Or you could just as well use veal -
after all, you have to be careful - Sicilians are touchy about their young
family members...

6 newborn or veal cutlets
Tomato gravy (see index)
4 cups mozzarella, 1cup parmesan, 1cup romano
Seasoned bread crumbs mixed with
parmesan
romano
salt
pepper
oregano
garlic powder
chopped parsley
Flour
eggwash (eggs and milk)
Peanut oil for frying.

Pound the cutlets.
Dredge in flour, eggs, then the bread crumb mixture.
Fry till golden brown in 350° peanut oil.
In a baking pan, place a layer of gravy,
then one of meat, gravy, and cheese.
Another layer each of meat, gravy, and cheese.
Then bake at 350° for 45 minutes.
Serve on hot pasta with romano cheese.



Southern Fried Small-fry

Tastes like fried chicken, which works just as well.
In fact you may want to practice cutting up whole chickens
for frying before you go for the real thing.
Whole chicken is much more efficient and inexpensive than buying pieces.

1 tiny human, cut int


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.