Use of a virtual class as a parametrized type def

Hi

I have a virtual class Transaction like this

virtual class Transaction #(int width=100, height=50);

/////////////////////
methods and constraints

/////////////////////////
endclass

and then i create some transaction types

typedef Transaction #() Transactionx

My question Is it a good pratcice to use this typedef as a parameter in my class i.e

class transactor #(int , int , type T= Transactionx)

endclass

And then use this class as a base class to be instantiated in other classes What are the shortcomings of this or any better alternative any one can suggest

In reply to arjumand:
A couple of issues with your question:

Creating a specialization of a parameterized virtual(abstract) class does not make it a non-virtual(concrete) class. You still need to extend it into a concrete class before constructing as an object.

class TransX extends Transaction#(100,50);
endclass
class TransY extends Transaction#(100,100);
endclass

These are now two concrete classes. However, they do not share the same common base class. If you want them to share a common base class, they need to be extended from the same unparameterized class, or the same specialization of a parameterized class.

Finally, specializing a class with a type that is an extension of another type does not make the two specializations an extension of each other. For example

class A;
endclass
class B extends A;
endclass
class xactor#(type T);
endclass

xactor#(A) xa_h;
xactor#(B) xb_h;

xb_h = new;
xa_h = ab_h; // not legal


xa_h and xb_h are two unique specializations and the fact that B is an extension of A is irrelevant.

Without knowing more about what you are trying to accomplish, its hard to know if any of this is relevant to you, or suggest a better alternative.

In reply to dave_59:

In reply to arjumand:
Hello Dave thankds for your reply
A couple of issues with your question:
Creating a specialization of a parameterized virtual(abstract) class does not make it a non-virtual(concrete) class. You still need to extend it into a concrete class before constructing as an object.

class TransX extends Transaction#(100,50);
endclass
Absolutely i know this as you wrote above
My core question was just to ask that i have to use a BFM from someone else which is built like that as i wrote above in my question.. i.e  A virtual class with some methods and constraints . Typedef the Transaction class to have a say Transactionx and use this as a parameter in normal class. 
class transactor #(int , int , type T= Transactionx)
endclass
The author call this class a base class constructed in a class called BFM.
class TransY extends Transaction#(100,100);
endclass

These are now two concrete classes. However, they do not share the same common base class. If you want them to share a common base class, they need to be extended from the same unparameterized class, or the same specialization of a parameterized class.
Finally, specializing a class with a type that is an extension of another type does not make the two specializations an extension of each other. For example

class A;
endclass
class B extends A;
endclass
class xactor#(type T);
endclass
xactor#(A) xa_h;
xactor#(B) xb_h;
xb_h = new;
xa_h = ab_h; // not legal

xa_h and xb_h are two unique specializations and the fact that B is an extension of A is irrelevant.
Without know more about what you are trying to accomplish, its hard to know if any of this is relevant to you, or suggest a better alternative.

In reply to arjumand:
Your question seems to be just “is it OK to pass a virtual class as a type parameter T to another class”

The answer is yes, as long as T is only used for things that would be OK for a virtual class type. (i.e. you are not going to have

class transactor #(int , int , type T= Transactionx)
  T handle = new; // this would not be OK if T were not a class, or a virtual class
endclass